[Rt-commit] rt branch, 4.4/ticket-enter-submit, created. rt-4.4.1-323-gbe3c674

Shawn Moore shawn at bestpractical.com
Thu Sep 21 15:51:57 EDT 2017


The branch, 4.4/ticket-enter-submit has been created
        at  be3c6749ba5f3ac12d0aa8f6e5d32bfb46f39141 (commit)

- Log -----------------------------------------------------------------
commit be3c6749ba5f3ac12d0aa8f6e5d32bfb46f39141
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Fri Mar 17 15:45:48 2017 -0400

    Suppress enter-keystroke form submission behavior on ticket create/reply
    
    This is too easy to trigger accidentally, especially when navigating
    autocomplete results. This is especially relevant after we added the
    drag and drop uploader in 4.4. Prior to 4.4, hitting enter would submit
    the form by activating the "Add More Files" button, which of course was
    harmless besides just reloading the page. Now in 4.4 it creates/updates
    the ticket, which can certainly have irreversible effects.
    
    Fixes: I#32632

diff --git a/share/static/js/util.js b/share/static/js/util.js
index eda0127..cb30a33 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -559,6 +559,15 @@ jQuery(function() {
         }, 'json');
         return false;
     });
+
+    jQuery('form[name=TicketCreate], form[name=TicketUpdate]').keypress(function (e) {
+        if (jQuery(e.target).is('textarea')) {
+            return true;
+        }
+        if (e.keyCode == 13) {
+            return false;
+        }
+    });
 });
 
 // focus jquery object in window, only moving the screen when necessary

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


More information about the rt-commit mailing list