Bug 1509488 - Use keydown handler instead of <key> for Shift+Ctrl+Tab. r=jaws

Differential Revision: https://phabricator.services.mozilla.com/D12744

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dão Gottwald 2018-11-26 16:07:07 +00:00
Родитель 15e4267fae
Коммит fbccdb1f61
2 изменённых файлов: 15 добавлений и 18 удалений

Просмотреть файл

@ -430,7 +430,6 @@ var ctrlTab = {
onKeyDown(event) {
if (event.keyCode != event.DOM_VK_TAB ||
!event.ctrlKey ||
!this.isOpen && event.shiftKey ||
event.altKey ||
event.metaKey) {
return;
@ -441,14 +440,20 @@ var ctrlTab = {
if (this.isOpen) {
this.advanceFocus(!event.shiftKey);
} else {
let tabs = gBrowser.visibleTabs;
if (tabs.length > 2) {
this.open();
} else if (tabs.length == 2) {
let index = tabs[0].selected ? 1 : 0;
gBrowser.selectedTab = tabs[index];
}
return;
}
if (event.shiftKey) {
this.showAllTabs();
return;
}
let tabs = gBrowser.visibleTabs;
if (tabs.length > 2) {
this.open();
} else if (tabs.length == 2) {
let index = tabs[0].selected ? 1 : 0;
gBrowser.selectedTab = tabs[index];
}
},
@ -593,13 +598,5 @@ var ctrlTab = {
// as Shift+Ctrl+Tab will be handled by the tab bar.
document.getElementById("menu_showAllTabs").hidden = !enable;
document.getElementById("menu_viewPopup")[toggleEventListener]("popupshowing", this);
// Also disable the <key> to ensure Shift+Ctrl+Tab never triggers
// Show All Tabs.
var key_showAllTabs = document.getElementById("key_showAllTabs");
if (enable)
key_showAllTabs.removeAttribute("disabled");
else
key_showAllTabs.setAttribute("disabled", "true");
},
};

Просмотреть файл

@ -267,7 +267,7 @@
<key id="key_fullZoomReset" key="&fullZoomResetCmd.commandkey;" command="cmd_fullZoomReset" modifiers="accel"/>
<key key="&fullZoomResetCmd.commandkey2;" command="cmd_fullZoomReset" modifiers="accel"/>
<key id="key_showAllTabs" command="Browser:ShowAllTabs" keycode="VK_TAB" modifiers="control,shift" disabled="true"/>
<key id="key_showAllTabs" keycode="VK_TAB" modifiers="control,shift"/>
<key id="key_switchTextDirection" key="&bidiSwitchTextDirectionItem.commandkey;" command="cmd_switchTextDirection" modifiers="accel,shift" />