From c29c2b90ca79f2cf9f795b526b0f0abd20693c3d Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Thu, 5 Jun 2014 11:57:53 +0900 Subject: [PATCH] Bug 1008772 part.1 tabs should handle non-printable keys with keydown event handlers in the system group rather than keypress event handlers in the normal group r=smaug+enndeakin --- browser/base/content/tabbrowser.xml | 59 ++++++++++++++++++++--------- toolkit/content/widgets/tabbox.xml | 40 +++++++++++-------- 2 files changed, 66 insertions(+), 33 deletions(-) diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index 6f4558d21872..f7ce49aa2f26 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -2885,7 +2885,7 @@ onget="return this.mCurrentBrowser.isSyntheticDocument;" readonly="true"/> - + + + + + + @@ -2982,8 +2996,11 @@ - diff --git a/toolkit/content/widgets/tabbox.xml b/toolkit/content/widgets/tabbox.xml index 7c7cb00a430a..fc7b08e26e38 100644 --- a/toolkit/content/widgets/tabbox.xml +++ b/toolkit/content/widgets/tabbox.xml @@ -147,12 +147,14 @@ return; } + // Don't check if the event was already consumed because tab + // navigation should always work for better user experience. + switch (event.keyCode) { case event.DOM_VK_TAB: if (event.ctrlKey && !event.altKey && !event.metaKey) if (this.tabs && this.handleCtrlTab) { this.tabs.advanceSelectedTab(event.shiftKey ? -1 : 1, true); - event.stopPropagation(); event.preventDefault(); } break; @@ -160,7 +162,6 @@ if (event.ctrlKey && !event.shiftKey && !event.altKey && !event.metaKey) if (this.tabs && this.handleCtrlPageUpDown) { this.tabs.advanceSelectedTab(-1, true); - event.stopPropagation(); event.preventDefault(); } break; @@ -168,7 +169,6 @@ if (event.ctrlKey && !event.shiftKey && !event.altKey && !event.metaKey) if (this.tabs && this.handleCtrlPageUpDown) { this.tabs.advanceSelectedTab(1, true); - event.stopPropagation(); event.preventDefault(); } break; @@ -178,7 +178,6 @@ var offset = window.getComputedStyle(this, "") .direction == "ltr" ? -1 : 1; this.tabs.advanceSelectedTab(offset, true); - event.stopPropagation(); event.preventDefault(); } break; @@ -188,7 +187,6 @@ var offset = window.getComputedStyle(this, "") .direction == "ltr" ? 1 : -1; this.tabs.advanceSelectedTab(offset, true); - event.stopPropagation(); event.preventDefault(); } break; @@ -203,8 +201,12 @@ - this._eventNode.removeEventListener("keypress", this, false); + const nsIEventListenerService = + Components.interfaces.nsIEventListenerService; + let els = Components.classes["@mozilla.org/eventlistenerservice;1"] + .getService(nsIEventListenerService); + els.removeSystemEventListener(this._eventNode, "keydown", this, false); @@ -806,39 +816,39 @@ ]]> - + - + - + - + - + - +