Closed Bug 2029534 Opened 1 month ago Closed 1 month ago

tabs.group() to a new window prepends a split view instead of appending it

Categories

(WebExtensions :: Frontend, defect, P2)

defect

Tracking

(firefox151 fixed)

RESOLVED FIXED
151 Branch
Tracking Status
firefox151 --- fixed

People

(Reporter: robwu, Assigned: robwu)

References

(Blocks 1 open bug)

Details

(Whiteboard: [addons-jira])

Attachments

(1 file)

In bug 2029099, I wrote a unit test that a split view can join a tab group in another window. The unit test however failed and demonstrates that the adoption of a split view results in the split view unexpectedly appearing at the left of the tab group, instead of at the right.

This is because internally, group.addTabs is called, which ought append tabs to a tab group.
In the regular case, tabIndex is used to select the last tab, but in the split view case, somehow elementIndex is used instead by addTabs (source). Changing it to tabIndex causes the unit test to pass.

I'm splitting the fix from bug 2029099, because the implementation changes in the other bug are 100% extension code, whereas this bug is caused by the implementation of tabbrowser. This logic was added relatively recently in bug 2006386.

Btw, changing elementIndex to tabIndex does not cause the test from bug 2029099 to fail, because the test there only checks whether the split view was moved, not where exactly it moved to: https://searchfox.org/firefox-main/rev/0989a082704f0bda8d370ccd57402645d834757e/browser/components/tabbrowser/test/browser/tabs/browser_tab_groups_tabContextMenu.js#567-572

Perhaps the exact location is not significant for the UI, but in the extension API we want consistent behavior, so I'm going to propose a patch that changes elementIndex to tabIndex.

The regular (non split view) case already uses tabIndex, which
results in the desired effect of appending tabs to a group.

In the split view case, the use of elementIndex instead of tabIndex
caused the split view to be inserted before ab existing group instead of
appended. Changing this to tabIndex fixes this inconsistency.

Severity: -- → S3
Status: NEW → ASSIGNED
Priority: -- → P2
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 151 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: