Bug 373996 - Attachment panel in message reader is not focusable / accessible with the keyboard (needs [TAB] stop) (fix hitting spacebar on attachmentToggle); r=bwinton, a=Standrd8 BETA_BASE_20110927
authorJim Porter <squibblyflabbetydoo@gmail.com>
Thu, 25 Aug 2011 00:28:08 -0500
changeset 8864 69f72be98a484f60dfccd34720e99ee0b72945d1
parent 8863 61e68359839bfa19501ba0ef827cfc6dccf4106a
child 8865 66cc3d55f88cf923c3730ee6b66621eaade65944
push idunknown
push userunknown
push dateunknown
reviewersbwinton, Standrd8
bugs373996
Bug 373996 - Attachment panel in message reader is not focusable / accessible with the keyboard (needs [TAB] stop) (fix hitting spacebar on attachmentToggle); r=bwinton, a=Standrd8
mail/base/content/mailWindowOverlay.js
--- a/mail/base/content/mailWindowOverlay.js
+++ b/mail/base/content/mailWindowOverlay.js
@@ -2281,28 +2281,31 @@ function MsgSynchronizeOffline()
 {
   window.openDialog("chrome://messenger/content/msgSynchronize.xul", "",
                     "centerscreen,chrome,modal,titlebar,resizable=yes",
                     {msgWindow:msgWindow});
 }
 
 function SpaceHit(event)
 {
+  // If focus is in chrome, we want to scroll the content window, unless
+  // the focus is on an important chrome button like the otherActionsButton
+  // popup; if focus is on a non-link content element like a button, bail so we
+  // don't scroll when the element is going to do something else.
+
   var contentWindow = document.commandDispatcher.focusedWindow;
-  // If focus is in chrome, we want to scroll the content window, unless
-  // the focus is on the otherActionsButton popup; if focus is on a
-  // non-link content element like a button, bail so we don't scroll
-  // when the element is going to do something else.
   let focusedElement = document.commandDispatcher.focusedElement;
 
   if (!gMessageDisplay.singleMessageDisplay) {
     contentWindow = document.getElementById("multimessage").contentWindow;
   } else if (contentWindow.top == window) {
+    // These elements should always take priority over scrolling.
+    const importantElements = ["otherActionsButton", "attachmentToggle"];
     contentWindow = window.content;
-    if (focusedElement && focusedElement.id == "otherActionsButton")
+    if (focusedElement && importantElements.indexOf(focusedElement.id) != -1)
       return;
   }
   else if (focusedElement && !hRefForClickEvent(event))
     return;
 
   var rssiframe = contentWindow.document.getElementById('_mailrssiframe');
   // If we are displaying an RSS article, we really want to scroll
   // the nested iframe.