mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-22 04:38:24 +08:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user