Menu

#1695 Fix side panel open sample ordering

open
nobody
None
2026-06-04
2026-06-01
Anonymous
No

Originally created by: KirtiRamchandani

Fixes [#1477].

Problem

The cookbook.sidepanel-open sample opened the tab-specific side panel before setting the tab-specific path. On the first click, Chrome showed the default side panel page; only a second click showed sidepanel-tab.html.

Root cause

chrome.sidePanel.open() must run during the user gesture, but the sample configured chrome.sidePanel.setOptions() after opening the panel. Reversing those calls inside the click handler would lose the user gesture before open() runs.

Solution

Preconfigure the tab-specific side panel path before the button is enabled or appended to the page. The click handlers now only call chrome.sidePanel.open(), so the first click opens the intended side panel page while preserving the user gesture requirement.

Tests

  • npx eslint functional-samples/cookbook.sidepanel-open/content-script.js functional-samples/cookbook.sidepanel-open/script.js functional-samples/cookbook.sidepanel-open/service-worker.js
  • npx prettier --check functional-samples/cookbook.sidepanel-open/README.md functional-samples/cookbook.sidepanel-open/content-script.js functional-samples/cookbook.sidepanel-open/script.js functional-samples/cookbook.sidepanel-open/service-worker.js
  • Node smoke check that the injected button is only appended after tab-specific setup and the extension page button is gated by setup
  • git diff --check origin/main..HEAD

Related

Tickets: #1477
Tickets: #1685
Tickets: #1688

Discussion


Log in to post a comment.