Hi everyone, I’m developing an extension that involves tab and tab group manipulation. I’ve encountered some unexpected behavior in Firefox when moving tabs near the boundaries of a tab group. According to the MDN Documentation:
A tab also joins a tab group when tabs.move places it between tabs that are part of a tab group.
However, I’ve met two cases where a tab is moved near the group boundaries but is still forced into the group by Firefox (v147.0.3):
Case 1: A tab starts before a group and is moved to the position immediately after the last tab in that group.
Case 2: A tab starts after a group and is moved to the position immediately before the first tab in that group.
The same API call works as expected on Chrome (the tab remains ungrouped).
It appears Firefox’s auto-join logic uses the tab’s original index to determine the joining condition.
One workaround is to call browser.tabs.ungroup after the move, but it causes a noticeable visual flicker/glitch as the tab joins and then leaves the group.
Is there a way to move a tab to these “boundary” positions while explicitly disabling the auto-join behavior?
No, the API doesn’t have a way to disable the group auto-join behavior when moving a tab.
I just did a quick search on Bugzilla and didn’t see anything that quite seemed to match the issue you described. I’d recommend creating a new WebExtensions compatibility bug.
Thanks for the detailed report with visual examples! Since this appears to be a browser-level limitation rather than an API issue, you might want to consider tracking this in the WebExtensions GitHub repository as well. In the meantime, one potential workaround could be to use browser.tabs.ungroup() followed by repositioning without creating a group context, or detect when the auto-join occurs and retry the operation with slight delays. Good catch on comparing with Chrome behavior - this kind of cross-browser difference is worth documenting.
I’ve experienced this as well with my window management extension. Especially damning is, if you move a pinned tab from one window to another window that has a tab group at the start of its tab row (specifically, use tabs.move to insert the pinned tab before the first unpinned tab), the pinned tab joins the tab group! It will at first glance appear unpinned, but if you right-click it to open the tab context menu, surprisingly you’ll see the “Unpin Tab” menu item. That’s a straight up bug.