Skip to content

Fix console music autoplay wedge; make music/open state per-tab - #12

Merged
jjsnack merged 1 commit into
mainfrom
feat/console-tab-session
Jul 31, 2026
Merged

Fix console music autoplay wedge; make music/open state per-tab#12
jjsnack merged 1 commit into
mainfrom
feat/console-tab-session

Conversation

@jjsnack

@jjsnack jjsnack commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fixes a real bug: a gesture-less AudioContext.resume() call never rejects when the browser blocks it — it just stays pending forever — so chiptune.on()'s playing = true never got reverted, and every later real click silently no-opped. Resume is now only ever attempted from an actual pointerdown/keydown.
  • Music and console open/closed state now live in sessionStorage gated by a window.name tab-instance marker: they survive full-page navigation within the same tab (this is a static site, every link click is a real reload), but a genuinely new tab always starts fresh/off — even one opened via a link, whose sessionStorage would otherwise arrive as a clone of the opener's.
  • Theme stays a global preference on localStorage, synced live to already-open sibling tabs via the storage event.

Test plan

  • node assets/js/console.js self-check passes
  • pnpm build succeeds
  • In a browser: music play, click a link to another page in the same tab — music should resume after one click on the new page. Open a link in a new tab — that tab should start with music off. Toggle theme — other already-open tabs should re-tint live.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CXUvHW2ZBJgqinhQ2YWMqs

Music and console open/closed now live in sessionStorage gated by a
window.name tab-instance marker, so they survive navigation within the
same tab but always start fresh in a genuinely new tab (even one opened
via a link, whose sessionStorage would otherwise arrive as a clone of
the opener's). Theme stays global on localStorage, synced live to
already-open sibling tabs.

Also fixes a real bug: a gesture-less AudioContext.resume() call never
rejects when the browser blocks it, it just stays pending forever, so
chiptune.on()'s `playing = true` never got reverted and every later,
gesture-backed attempt silently no-opped. Resume is now only ever
attempted from an actual pointerdown/keydown.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CXUvHW2ZBJgqinhQ2YWMqs
@jjsnack
jjsnack merged commit 41edc3f into main Jul 31, 2026
1 check passed
@jjsnack
jjsnack deleted the feat/console-tab-session branch July 31, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant