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 33386 4f66ed336bcf
parent 33385 151bb059674b
child 33387 e87ac6b1e47e
push id2368
push userclokep@gmail.com
push dateMon, 28 Jan 2019 21:12:50 +0000
treeherdercomm-beta@56d23c07d815 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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);
       ]]>