Repository navigation
Keep fullscreen across pages in the same tab (#370) - #371
Merged
Merged
Conversation
Each game is its own document, so every navigation between the menu and a game left fullscreen, and the player had to press the button again on each page. The choice is now kept in sessionStorage for the tab and the first tap or key on the next page re-enters fullscreen (a browser refuses it without a user activation). The exit caused by leaving the page is ignored; turning it off on the page forgets it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Author
|
Diff review
|
Merged
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.
Closes #370
Reported by @xmha97: turning on fullscreen and then opening a game (or going back to the menu) dropped back to the browser window.
Why
Every game is its own page, and a browser ends fullscreen on every page load. It only enters it again from a user activation, so it cannot simply be switched back on at load.
What changed
www/lib/chogan.js: afterChogan.fullscreen, a small block keeps the choice insessionStorage(chogan.fullscreen, this tab only, nothing saved across sessions). On the next page, the firstpointerup/keydown/click(capture phase, Escape excluded, only withnavigator.userActivation.isActive) re-enters fullscreen and the listeners are removed. The exit that comes from leaving the page (afterpagehide) is ignored; exiting on the page (button, Esc, back gesture) clears it. A tap on the fullscreen button itself is left to the button (data-fs), otherwise restoring first would make the button exit again.tools/test.js:testFullscreenCarry()runs the real core section against a fake browser across three pages.MIN_CHECKS4185 → 4203 (4191 on main + 13 new checks, minus one).Proof
Test on main's code with the new test.js:
✗ 5 errors of 4204 checks(remembered, ignore leave exit, next page waits, first tap re-enters, data-fs). On the branch:all 4204 checks green, exit 0.tools/browser-check.sh: 36 of 36 pages, exit 0.Headless Chrome (Playwright), dots → fullscreen → navigate to sudoku → tap:
Screenshots at 1280 and 390, fa/en, light/dark: layout unchanged, the bar button shows "Exit fullscreen" after the restore, and the restoring tap still reaches the game (a cell gets selected).
Not tested
Real Android Chrome and iOS Safari (iPhone Safari has no Fullscreen API for pages, so the button is not shown there anyway). The Android app is unaffected (
available()is false under Capacitor).🤖 Generated with Claude Code