Originally created by: KirtiRamchandani
Fixes [#1477].
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.
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.
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.
npx eslint functional-samples/cookbook.sidepanel-open/content-script.js functional-samples/cookbook.sidepanel-open/script.js functional-samples/cookbook.sidepanel-open/service-worker.jsnpx 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.jsgit diff --check origin/main..HEAD