Skip to content

Commit 0e51d1b

Browse files
committed
Cyclic focus to next/previous sibling tab #3725
1 parent 1ba22ab commit 0e51d1b

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

webextensions/background/handle-misc.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,17 @@ async function onShortcutCommand(command) {
259259
case 'focusPreviousSibling':
260260
TabsInternalOperation.activateTab(
261261
activeTab.$TST.previousSiblingTab ||
262-
activeTab.$TST.parent && activeTab.$TST.parent.$TST.lastChild
262+
(activeTab.$TST.parent ?
263+
activeTab.$TST.parent.$TST.lastChild :
264+
Tab.getLastRootTab(activeTab.windowId))
263265
);
264266
return;
265-
case 'focusNextSibling':
267+
case 'focusNextSibling':
266268
TabsInternalOperation.activateTab(
267269
activeTab.$TST.nextSiblingTab ||
268-
activeTab.$TST.parent && activeTab.$TST.parent.$TST.firstChild
270+
(activeTab.$TST.parent ?
271+
activeTab.$TST.parent.$TST.firstChild :
272+
Tab.getFirstVisibleTab(activeTab.windowId))
269273
);
270274
return;
271275

webextensions/common/Tab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2796,7 +2796,7 @@ Tab.getRootTabs = (windowId = null, options = {}) => {
27962796
};
27972797

27982798
Tab.getLastRootTab = (windowId, options = {}) => {
2799-
const tabs = this.getRootTabs(windowId, options);
2799+
const tabs = Tab.getRootTabs(windowId, options);
28002800
return tabs[tabs.length - 1];
28012801
};
28022802

0 commit comments

Comments
 (0)