Repository navigation
Keep one Back guard per open mobile layer - #442
Open
IvoryHeart wants to merge 1 commit into
Open
IvoryHeart wants to merge 1 commit into
IvoryHeart wants to merge 1 commit into
Conversation
Closing the top layer with the phone's Back re-pushed the shared guard while handling Back. Chrome skips history entries a page adds without a user gesture, so the next Back left the page instead of closing the next layer. Each open layer now has its own guard, pushed when it opens; Back consumes one per layer and never pushes, and layers closed on screen take theirs with them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DfhSCw8PA5ALciQTEYHAAP
This branch has not been deployed
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
Follow-up to #433. With two mobile layers open (for example the input dock and the tab sheet), the phone's Back closes the first one correctly. In Chrome on Android, the second Back then leaves Roamgate instead of closing the remaining layer.
The cause: after Back closes the top layer,
reconcilere-pushes the shared guard while thepopstateis being handled. Chrome's back-button intervention skips history entries that a page adds without a user gesture. It flags the base entry that pushed the guard, so the next Back skips past the page. Tests drive Back withhistory.back(), where the intervention does not apply, so the existing suite passes.The change:
roamgateBack: n).history.back()at a time, as before. The next Back still leaves the page in one press.pagehide/pageshowhandling are unchanged. A guard from before this change (roamgateBack: true) still reads as depth 1.Tests
web/src/systemBack.test.ts: a new case opens two layers, presses Back twice, and asserts that each press closes one layer and thatpushStateis never called while Back is handled. It fails onmain(one push) and passes here. All existing cases pass unchanged.web/src/components/ThemedSelect.test.ts: its simulated Back used to land directly on the unguarded base, which modelled a single guard. It now pops one guard per press, like a browser does with one guard per layer.Validation
bun run format:check,bun run lintandbun run typecheck:quickare clean.bun run test:quick: everything passes except three cases inserver/src/http/auth-process.test.ts. They fail the same way on a cleanmaincheckout in this environment and are unrelated.bun run build:web: initial JS 803.9/804 KiB, gzip 246.0/256 KiB. Within the current budget, with no bump needed.🤖 Generated with Claude Code
https://claude.ai/code/session_01DfhSCw8PA5ALciQTEYHAAP