Add the Open Tabs panel to the revamped sidebar
Categories
(Firefox :: Sidebar, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox153 | --- | fixed |
People
(Reporter: nsharpley, Assigned: dr.seed.lu, Mentored)
References
(Blocks 3 open bugs)
Details
(Whiteboard: [fidefe-sidebar][outreachy-sidebar-2026])
Attachments
(1 file, 1 external file)
|
113.10 KB,
image/png
|
Details |
First Step
Add pref("sidebar.openTabsPanel.enabled", false) to browser/app/profile/firefox.js. We want to gate this feature behind a pref until it is complete. i.e. the panel won't be available unless a user has switch this pref to true in about:config.
Architecture Decision
Reusue the existing OpenTabsController and OpenTabs.sys.mjs infrastructure from Firefox View, but render into the sidebar's own sidebar-tab-list component (same as History/Synced Tabs panels) rather than Firefox View's opentabs-tab-list. This keeps the panel visually consistent with the rest of the sidebar and avoids pulling in Firefox View's ViewPage lifecycle, card containers, and other coupling.
Files to Create
browser/components/sidebar/sidebar-opentabs.html- HTML entry point (mirrorssidebar-syncedtabs.html)browser/components/sidebar/sidebar-opentabs.mjs-SidebarOpenTabs extends SidebarPagecomponentbrowser/components/sidebar/sidebar-opentabs.css- Panel-specific styles (minimal to start)browser/components/sidebar/tests/browser/browser_opentabs_sidebar.js- Browser tests
Files to Modify
browser/components/sidebar/browser-sidebar.js
- Add viewOpenTabsSidebar: "opentabs" to toolsNameMap (~line 15)
- Add panel entry to generateSidebarsMap() after the bookmarks entry (~line 185):
["viewOpenTabsSidebar", this.makeSidebar({
name: "opentabs",
elementId: "sidebar-switcher-opentabs",
url: "chrome://browser/content/sidebar/sidebar-opentabs.html",
revampL10nId: "sidebar-menu-open-tabs-label",
iconUrl: "chrome://browser/skin/tabs.svg",
contextMenuId: "sidebar-opentabs-context-menu",
})],
browser/locales/en-US/browser/sidebar.ftl
- Add sidebar-menu-open-tabs-label, sidebar-opentabs-title
browser/components/sidebar/jar.mn
- Add 3 content lines for .css, .html, .mjs
browser/components/sidebar/tests/browser/browser.toml
- Register the new test file
Component Design (sidebar-opentabs.mjs)
SidebarOpenTabs extends SidebarPage
Properties:
tabs(Array)
Lazy imports:
getTabsTargetForWindow(OpenTabs.sys.mjs)OpenTabsController(OpenTabsController.sys.mjs)
connectedCallback():
openTabsTarget = getTabsTargetForWindow(topWindow)openTabsTarget.addEventListener("TabChange", this)tabs = openTabsTarget.getTabsForWindow(topWindow)
disconnectedCallback():
openTabsTarget.removeEventListener("TabChange", this)
handleEvent(e):
- "TabChange" → refresh this.tabs
onPrimaryAction(e):
browserWindow.focus(); gBrowser.selectedTab = tabElement
render():
- stylesheet() + panel-header + sidebar-tab-list
Data Flow
OpenTabsTarget (getTabsTargetForWindow)
↓ "TabChange" event
SidebarOpenTabs → this.tabs = getTabsForWindow(topWindow)
↓ requestUpdate()
render() → OpenTabsController.getTabListItems(tabs, false)
↓ normalized items
<sidebar-tab-list> → <sidebar-tab-row> per tab
↓ fxview-tab-list-primary-action event
onPrimaryAction() → gBrowser.selectedTab = tabElement
Key Pitfalls to Watch For
- openTabsTarget listener lifecycle — must call removeEventListener in disconnectedCallback, or the singleton keeps firing into a detached component
- toolsNameMap + default pref — adding "opentabs" as a tool key means it needs to be in the default value of the sidebar.main.tools pref (browser/app/profile/firefox.js) to be enabled by default
- SidebarTreeView for keyboard nav — instantiate new SidebarTreeView(this, { multiSelect: false }) (matching Synced Tabs) to avoid silent failures in keyboard multi-select
- Tab click behavior — use gBrowser.selectedTab = tabElement directly, NOT navigateToLink (which is for URL/history navigation)
Test Coverage
- Panel opens via SidebarController.show("viewOpenTabsSidebar")
- Tab list row count matches gBrowser.openTabs (minus hidden tabs)
- Clicking a row selects the correct tab
- Opening/closing a tab updates the list
NOTE: telemetry, context menus, and search input will be handled in follow up bugs
Updated•6 months ago
|
Updated•6 months ago
|
| Reporter | ||
Updated•6 months ago
|
| Reporter | ||
Updated•6 months ago
|
| Reporter | ||
Comment 1•6 months ago
|
||
| Reporter | ||
Comment 2•6 months ago
|
||
Note: "remember collapsed and expanded state for windows and devices" will be implemented in a follow up bug.
Adds an Open Tabs panel to the revamped sidebar, gated behind the new
sidebar.openTabsPanel.enabled pref (default false) until the feature is
complete.
The panel reuses the existing Firefox View OpenTabs infrastructure
(getTabsTargetForWindow and OpenTabsController) and renders the current
window's tabs into the sidebar's sidebar-tab-list component. It listens
for TabChange events to stay in sync, and selecting a row activates the
corresponding tab.
Please Note: the panel is registered via registerPrefSidebar() rather than a
static generateSidebarsMap() entry, so its availability follows the
pref, consistent with the other pref-gated panels in the sidebar.
This also needed a label mapping in sidebar-customize.mjs and a
sidebar-menu-open-tabs-header string.
I am happy to adjust if you'd prefer a
different approach.
Search, sorting, multi-window grouping, the context menu, and telemetry
are deferred to follow-up bugs.
Updated•6 months ago
|
Backed out for causing mochitests failures @ browser_extensions_sidebar.js
Comment 9•5 months ago
|
||
Backed out for causing failures at nsContentSecurityUtils.cpp.
Backout link: https://hg.mozilla.org/integration/autoland/rev/332b2b44ee5a
Failure log: https://treeherder.mozilla.org/logviewer?job_id=569057015&repo=autoland&task=HmYA75r_RHWO3nYOs1iBZg.0&lineNumber=9241
Comment 10•5 months ago
|
||
Comment 11•5 months ago
|
||
| bugherder | ||
Updated•5 months ago
|
Description
•