Bug 1520908 - prevent opening the find bar when typing a slash while a chat conversation is focused. r=nhnt11
authorFlorian Quèze <florian@queze.net>
Thu, 17 Jan 2019 23:52:22 +0100
changeset 34240 4f66ed336bcf89fd9e5dfc0a7d23ab2c268a27e8
parent 34239 151bb059674b31295004b22d565889f6d98d6cc3
child 34241 e87ac6b1e47e3084a17a6547049c8f0a01b46c59
push id389
push userclokep@gmail.com
push dateMon, 18 Mar 2019 19:01:53 +0000
reviewersnhnt11
bugs1520908
Bug 1520908 - prevent opening the find bar when typing a slash while a chat conversation is focused. r=nhnt11
mail/components/im/content/imconversation.xml
--- a/mail/components/im/content/imconversation.xml
+++ b/mail/components/im/content/imconversation.xml
@@ -930,19 +930,27 @@
 
         if (event.charCode == 0 &&  // it's not a character, it's a command key
             (event.keyCode != 13 && // Return
              event.keyCode != 8 &&  // Backspace
              event.keyCode != 46))  // Delete
           return;
 
         if (accelKeyPressed ||
-            !Services.prefs.getBoolPref("accessibility.typeaheadfind"))
+            !Services.prefs.getBoolPref("accessibility.typeaheadfind")) {
           this.editor.focus();
 
+          // A common use case is to click somewhere in the conversation and
+          // start typing a command (often /me). If quick find is enabled, it
+          // will pick up the "/" keypress and open the findbar.
+          if (event.charCode == "/".charCodeAt(0)) {
+            event.preventDefault();
+          }
+        }
+
         // Returns for Ctrl+V
         if (accelKeyPressed)
           return;
 
         // resend the event
         let clonedEvent = new KeyboardEvent("keypress", event);
         this.editor.inputField.dispatchEvent(clonedEvent);
       ]]>