fix: sidebar arrow hint stays visible until sidebar actually opens

Previously the welcome page arrow hid immediately when the extension's
content script loaded — but extension loaded ≠ sidebar open. Now the
signal flow is: sidepanel connects → tells background.js → relays to
content script → dispatches gstack-extension-ready → arrow hides.

Adds welcome-page.test.ts: 14 tests verifying arrow, branding, feature
cards, dark theme, and auto-hide behavior via real HTTP server.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-04-04 07:13:12 -07:00
parent 41dccfd25e
commit 43dba47237
5 changed files with 172 additions and 18 deletions

View File

@@ -326,11 +326,18 @@ function startBasicPicker() {
document.addEventListener('keydown', onBasicKeydown, true);
}
// Notify the page that the gstack extension is active (used by welcome page)
document.dispatchEvent(new CustomEvent('gstack-extension-ready'));
// Do NOT dispatch gstack-extension-ready here — the extension being loaded
// does not mean the sidebar is open. The welcome page arrow hint should only
// hide when the sidebar is actually open. We dispatch it when we receive
// a 'sidebarOpened' message from background.js.
// Listen for messages from background worker
chrome.runtime.onMessage.addListener((msg) => {
// Sidebar actually opened — now hide the welcome page arrow hint
if (msg.type === 'sidebarOpened') {
document.dispatchEvent(new CustomEvent('gstack-extension-ready'));
return;
}
if (msg.type === 'startBasicPicker') {
startBasicPicker();
return;