Skip to content

Commit

Permalink
Treat child tabs from pinned parent same as tabs from unpinned tabs i…
Browse files Browse the repository at this point in the history
…f there is an alias group tab #3431
  • Loading branch information
piroor committed Jan 17, 2024
1 parent 1b1bf10 commit 1b87572
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion webextensions/background/handle-new-tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,21 @@ async function handleTabsFromPinnedOpener(tab, opener, { activeTab } = {}) {
tab.$TST.setAttribute(Constants.kPERSISTENT_ALREADY_GROUPED_FOR_PINNED_OPENER, true);
tab.$TST.temporaryMetadata.set('alreadyMovedAsOpenedFromPinnedOpener', true);
// it could be updated already...
const lastRelatedTab = opener.$TST.lastRelatedTabId == tab.id ? opener.$TST.previousLastRelatedTab : opener.$TST.lastRelatedTab;
const lastRelatedTab = opener.$TST.lastRelatedTabId == tab.id ?
opener.$TST.previousLastRelatedTab :
opener.$TST.lastRelatedTab;
// If there is already opened group tab, it is more natural that
// opened tabs are treated as a tab opened from unpinned tabs.
const insertAt = configs.autoAttachOnOpenedWithOwner == Constants.kNEWTAB_OPEN_AS_CHILD_NEXT_TO_LAST_RELATED_TAB ?
Constants.kINSERT_NEXT_TO_LAST_RELATED_TAB :
configs.autoAttachOnOpenedWithOwner == Constants.kNEWTAB_OPEN_AS_CHILD_TOP ?
Constants.kINSERT_TOP :
configs.autoAttachOnOpenedWithOwner == Constants.kNEWTAB_OPEN_AS_CHILD_END ?
Constants.kINSERT_END :
undefined;
return Tree.attachTabTo(tab, parent, {
lastRelatedTab,
insertAt,
forceExpand: true, // this is required to avoid the group tab itself is active from active tab in collapsed tree
broadcast: true
});
Expand Down

0 comments on commit 1b87572

Please sign in to comment.