Skip to content

Commit 5737c8a

Browse files
committed
Update native tab groups membership on drag and drop aggressively
1 parent 6dc5601 commit 5737c8a

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

webextensions/background/commands.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,23 @@ async function performTabsDragDrop(params = {}) {
490490
return;
491491
}
492492

493+
const nativeTabGroupId = params.attachTo ?
494+
params.attachTo.groupId :
495+
(params.insertAfter && params.insertAfter.groupId != -1) ?
496+
params.insertAfter.groupId :
497+
params.insertBefore ?
498+
params.insertBefore.groupId :
499+
-1;
500+
if (nativeTabGroupId == -1) {
501+
await browser.tabs.ungroup(params.tabs.map(tab => tab.id));
502+
}
503+
else {
504+
await browser.tabs.group({
505+
groupId: nativeTabGroupId,
506+
tabIds: params.tabs.map(tab => tab.id),
507+
});
508+
}
509+
493510
const movedTabs = await moveTabsWithStructure(params.tabs, {
494511
...params,
495512
windowId, destinationWindowId,

0 commit comments

Comments
 (0)