From cba40dc9fd05f4fa97fbf7bc0aa75fee6136a958 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 25 Aug 2019 21:03:29 -0400 Subject: [PATCH] Prevents Enter from submitting the jot form in the ACL search field - Disable browser autocomplete in jot ACL search field --- view/js/acl.js | 9 ++++++++- view/templates/acl_selector.tpl | 2 +- view/theme/frio/templates/acl_selector.tpl | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/view/js/acl.js b/view/js/acl.js index d01ffe7cbd..b50dbaec8d 100644 --- a/view/js/acl.js +++ b/view/js/acl.js @@ -109,7 +109,14 @@ ACL.prototype.search = function(){ ACL.prototype.on_search = function(event){ if (this.kp_timer) clearTimeout(this.kp_timer); - this.kp_timer = setTimeout( this.search.bind(this), 1000); + + // Triggers an immediate search while preventing form submission + if (event.key === 'Enter') { + this.search(); + event.preventDefault(); + } else { + this.kp_timer = setTimeout( this.search.bind(this), 500); + } }; ACL.prototype.on_showall = function(event){ diff --git a/view/templates/acl_selector.tpl b/view/templates/acl_selector.tpl index 6755f2a198..da86a478bf 100644 --- a/view/templates/acl_selector.tpl +++ b/view/templates/acl_selector.tpl @@ -1,6 +1,6 @@
- + {{$showall}}
diff --git a/view/theme/frio/templates/acl_selector.tpl b/view/theme/frio/templates/acl_selector.tpl index a96271671b..47415634d1 100644 --- a/view/theme/frio/templates/acl_selector.tpl +++ b/view/theme/frio/templates/acl_selector.tpl @@ -4,7 +4,7 @@