Closed Bug 2039294 Opened 6 months ago Closed 5 months ago

Add the Open Tabs panel to the revamped sidebar

Categories

(Firefox :: Sidebar, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
153 Branch
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)

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 (mirrors sidebar-syncedtabs.html)
  • browser/components/sidebar/sidebar-opentabs.mjs - SidebarOpenTabs extends SidebarPage component
  • browser/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

  1. 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",
  })],
  1. browser/locales/en-US/browser/sidebar.ftl
  • Add sidebar-menu-open-tabs-label, sidebar-opentabs-title
  1. browser/components/sidebar/jar.mn
  • Add 3 content lines for .css, .html, .mjs
  1. 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

  1. openTabsTarget listener lifecycle — must call removeEventListener in disconnectedCallback, or the singleton keeps firing into a detached component
  2. 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
  3. SidebarTreeView for keyboard nav — instantiate new SidebarTreeView(this, { multiSelect: false }) (matching Synced Tabs) to avoid silent failures in keyboard multi-select
  4. 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

Alias: sidebar-opentabs
Alias: sidebar-opentabs
Blocks: 2039574
Blocks: 2039590

Note: "remember collapsed and expanded state for windows and devices" will be implemented in a follow up bug.

Blocks: 2039595
Blocks: 2039596
Blocks: 2039601
Blocks: 2040752
Blocks: 2040756

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.

Assignee: nobody → dr.seed.lu
Status: NEW → ASSIGNED
Blocks: 2041801
Blocks: 2041802
Pushed by nsharpley@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/3b1d76107e10 https://hg.mozilla.org/integration/autoland/rev/773684eaf47b Add the Open Tabs panel to the revamped sidebar r=kcochrane,nsharpley,fluent-reviewers,desktop-theme-reviewers,flod
Pushed by pstanciu@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/75127bf16709 https://hg.mozilla.org/integration/autoland/rev/2c314a15140c Revert "Bug 2039294 - Add the Open Tabs panel to the revamped sidebar r=kcochrane,nsharpley,fluent-reviewers,desktop-theme-reviewers,flod" for causing mochitests failures @ browser_extensions_sidebar.js

Backed out for causing mochitests failures @ browser_extensions_sidebar.js

Flags: needinfo?(dr.seed.lu)
Pushed by kcochrane@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/ba0e9280bb6c https://hg.mozilla.org/integration/autoland/rev/db3a3ce3852b Add the Open Tabs panel to the revamped sidebar r=kcochrane,nsharpley,fluent-reviewers,desktop-theme-reviewers,flod
Pushed by abutkovits@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/0196514009e2 https://hg.mozilla.org/integration/autoland/rev/332b2b44ee5a Revert "Bug 2039294 - Add the Open Tabs panel to the revamped sidebar r=kcochrane,nsharpley,fluent-reviewers,desktop-theme-reviewers,flod" for causing failures at nsContentSecurityUtils.cpp.
Pushed by kcochrane@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/6110cc452553 https://hg.mozilla.org/integration/autoland/rev/ae9ba9e17e83 Add the Open Tabs panel to the revamped sidebar r=kcochrane,nsharpley,fluent-reviewers,desktop-theme-reviewers,flod
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 153 Branch
Depends on: 2043952
Flags: needinfo?(dr.seed.lu)
QA Whiteboard: [qa-triage-done-c154/b153]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: