[Rt-commit] rt branch, 4.4/disable-submit-on-enter-in-autocomplete, created. rt-4.4.4-237-gacaf8019b2

Blaine Motsinger blaine at bestpractical.com
Wed Feb 3 20:49:47 EST 2021


The branch, 4.4/disable-submit-on-enter-in-autocomplete has been created
        at  acaf8019b252c57f3df107202a1e2003825cac4b (commit)

- Log -----------------------------------------------------------------
commit acaf8019b252c57f3df107202a1e2003825cac4b
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Mon Aug 31 16:30:29 2020 -0500

    Disable submit on enter in autocomplete inputs
    
    This commit disables submit on enter keypress for email inputs on
    ticket create pages.
    
    Submit on enter keypress is still allowed for owner and queue
    selects on ticket pages, user and group selects for Admin pages,
    watcher and groups on ticket modify people pages, create depends
    on link forms.
    
    Fixes: I#32632

diff --git a/share/static/js/util.js b/share/static/js/util.js
index d5bf84562a..d791e1284d 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -527,6 +527,18 @@ function addprincipal_onchange(ev, ui) {
     }
 }
 
+// disable submit on enter in autocomplete boxes
+jQuery(function() {
+    jQuery('input[data-autocomplete], input.ui-autocomplete-input').each(function() {
+        var input = jQuery(this);
+
+        input.on('keypress', function(event) {
+            if (event.keyCode === 13 && jQuery('ul.ui-autocomplete').is(':visible')) {
+                return false;
+            }
+        });
+    });
+});
 
 function escapeCssSelector(str) {
     return str.replace(/([^A-Za-z0-9_-])/g,'\\$1');

-----------------------------------------------------------------------


More information about the rt-commit mailing list