summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-06-21 23:37:14 +0200
committerGitHub <noreply@github.com>2018-06-21 23:37:14 +0200
commit7ab0335eaf0f5cc7bc115acbf12fda75bd40044f (patch)
tree8c76ddfc54417404b59c720defd7ab6b76b52f59
parent1bedfce928647a96d36ce3319e1008e650ba13cb (diff)
parentf4e988c314253464af3a2d7c4706d11801f75813 (diff)
downloadnextcloud-server-7ab0335eaf0f5cc7bc115acbf12fda75bd40044f.tar.gz
nextcloud-server-7ab0335eaf0f5cc7bc115acbf12fda75bd40044f.zip
Merge pull request #9954 from nextcloud/search-form-preventdefaults
Prevent search form submit
-rw-r--r--core/search/js/search.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/core/search/js/search.js b/core/search/js/search.js
index 20d7f0f915f..461c963c471 100644
--- a/core/search/js/search.js
+++ b/core/search/js/search.js
@@ -86,15 +86,19 @@
// Register input event
document
.getElementById('searchbox')
- .addEventListener('input', _.debounce(this.search, 500), true);
+ .addEventListener('input', _.debounce(self.search, 500), true);
document
.querySelector('form.searchbox')
- .addEventListener('submit', _.debounce(this.search, 500), true);
+ .addEventListener('submit', function(event) {
+ // Avoid form submit
+ event.preventDefault();
+ _.debounce(self.search, 500);
+ }, true);
// Register reset
document
.querySelector('form.searchbox')
- .addEventListener('reset', _.debounce(this.reset, 500), true);
+ .addEventListener('reset', _.debounce(self.reset, 500), true);
// Register esc key shortcut reset if focused
document.addEventListener('keyup', function(event) {