Fix console music autoplay wedge; make music/open state per-tab - #12
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AudioContext.resume()call never rejects when the browser blocks it — it just stays pending forever — sochiptune.on()'splaying = truenever got reverted, and every later real click silently no-opped. Resume is now only ever attempted from an actualpointerdown/keydown.sessionStoragegated by awindow.nametab-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, whosesessionStoragewould otherwise arrive as a clone of the opener's.localStorage, synced live to already-open sibling tabs via thestorageevent.Test plan
node assets/js/console.jsself-check passespnpm buildsucceedsmusic 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