Verify that active tab stays active when tabGroups.collapsed is set to true with tabGroups.update()
Categories
(WebExtensions :: General, task, P3)
Tracking
(Not tracked)
People
(Reporter: robwu, Unassigned, Mentored)
References
(Blocks 2 open bugs)
Details
(Keywords: dev-doc-complete, good-first-bug)
The current test coverage for collapsed tabs only tests the behavior of non-active tabs: https://searchfox.org/mozilla-central/rev/387160feb07b75ae76bfc12df035a10f58d25168/browser/components/extensions/test/browser/browser_ext_tabGroups_collapsed.js#24-25,31-34,36-39,41-42
With bug 1971232, it will become possible to add active tabs to collapsed groups. We should expand test coverage (possibly with a new add_task to keep the test simple and understandable), for the following scenarios:
- All tests have at least 2 windows.
- Add active tab to a group, verify that it is still active.
- Collapse group, verify that the tab is still active.
- Uncollapse group, verify that the tab is still active.
Currently (before bug 1971232), the behavior is that another nearby tab gets activated when an active tab's tab group is collapsed. This test should verify that the new behavior is: an active tab stays active even if it is part of a collapsed group.
| Reporter | ||
Comment 1•1 year ago
|
||
Currently (before bug 1971232), the behavior is that another nearby tab gets activated when an active tab's tab group is collapsed. This test should verify that the new behavior is: an active tab stays active even if it is part of a collapsed group.
The new behavior was already implemented in Firefox 142 (bug 1949401).
dev-doc-needed:
Document the concept of collapsed more clearly in the TabGroups.collapsed type, and link to that from the APIs that read/set collapsed:
- https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabGroups/TabGroup#collapsed
- https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabGroups/update#collapsed
- https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabGroups/query#collapsed
In terms of what collapsed means:
- Call out that collapsed means that the tabs of the tab group are hidden from the tabstrip, except possibly for active tabs (which are shown even if the other tabs of the collapsed group are collapsed, as of Firefox 142).
- This state is independent of the
hiddenflag associated withtabs.hide()API
| Reporter | ||
Comment 2•1 year ago
|
||
I currently do not have the engineering bandwidth to take the task of writing the tests. We should have documentation though.
Could you manually verify that the behaviors are as expected (I expect that it will work, but we still need to verify), and work with Richard to create documentation (task described in comment 1)?
I have verified the behavior using a modified version of the tab tab tab example with this code:
else if (e.target.id === "tabs-group") {
callOnActiveTab((tab) => {
console.error(`Tab: ${tab.id}`);
browser.tabGroups
.update(tab.groupId , {collapsed: true})
.then(callOnActiveTab((tab) => {console.error(`Tab: ${tab.id}`)}))
.catch((err) => console.error(`Error: ${err}`));;
});
}
Then ran on an active tab in a group. Visually confirmed that the active tab remained active in a collapse group, and that the tab ID returned in the console was the same before and after.
Good enough?
| Reporter | ||
Comment 4•1 year ago
|
||
(In reply to rbloor from comment #3)
browser.tabGroups .update(tab.groupId , {collapsed: true}) .then(callOnActiveTab((tab) => {console.error(`Tab: ${tab.id}`)}))
Put () => after .then, otherwise you would immediately be looking up the active tab before tabGroups.update resolved.
Good enough?
Other than that, good enough. Thanks for taking this on!
| Reporter | ||
Comment 5•1 year ago
|
||
Adding good-first-bug since the task here is clear (described in the initial comment). The nice thing about this task is that the feature is connected to browser UI, which makes it easier to interactively see the effect of API calls, even when testing manually.
MDN documentation update in Bug-1978643 describe amended tab group collapse behavior #40715
Description
•