Repository navigation
Close mobile layers with the phone's Back - #433
Merged
Merged
Conversation
This was referenced Oct 16, 2026
On phones, Back left Roamgate even with the tab sheet, the input dock or a mobile view such as Files open. A small hook, useSystemBack, now gives open layers one history entry: Back closes the topmost layer (the tab sheet above the dock and mobile views; equal levels newest first) and the entry returns while layers remain. When the last layer closes on screen, the entry is removed once, even if several closed in the same commit, so the next Back leaves the page in one press. A layer opened while that removal is pending keeps its entry, and unmounting leaves history alone. Desktop is unchanged. The initial JS budget rises from 802 to 804 KiB for the hook. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AWodzpMyqdBcX25EE9HhDG
IvoryHeart
force-pushed
the
mobile-system-back
branch
from
October 16, 2026 21:09
8836bcd to
e4b03a7
Compare
Coordinate dropdown and panel Back handling, ignore hidden Composer layers, and clean up guards on remount and reload. Preserve navigation through obsolete guards in both directions and add regression coverage.
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
On phones, the system Back gesture or button currently leaves Roamgate, even when the tab sheet, the input dock or a mobile view such as Files is open. This PR makes Back close the open layer first, the way native apps behave.
web/src/systemBack.ts:useSystemBack(open, close, level). It is active only in the mobile layout.popup)panel, active pane only)panel). Back returns to the session throughactivateTerminalSurface.FEATURES.md: one line under Mobile and PWA.scripts/check-web-assets.mjs: the initial JS budget goes from 802 to 804 KiB.mainmeasures 802.0/802 KiB; with the hook it is 803.0 KiB, and gzip is 245.6/256 KiB.Tests
web/src/systemBack.test.ts. It uses happy-dom in an isolated runtime, followingTerminalView.inputMode.test.ts, and renders real React commits under StrictMode. It covers:TerminalView.inputMode.test.ts: itslayoutPreferencesmock gainsuseLayoutPreferences, becauseTerminalViewnow calls the hook.Validation
bun run format:check,bun run lint,bun run typecheckandbun run typecheck:bunpass.bun run test:quick: 3720 pass, 0 fail.🤖 Generated with Claude Code
https://claude.ai/code/session_01AWodzpMyqdBcX25EE9HhDG