Repository navigation
A sheet dismissed from a route pushed inside it closes the whole sheet on iOS - #8
Merged
Merged
Conversation
janicduplessis
marked this pull request as ready for review
November 15, 2026 01:23
janicduplessis
force-pushed
the
@janic/web-push-in-sheet
branch
from
November 15, 2026 02:26
6bc880c to
50b18c2
Compare
…t on iOS Once a route was pushed inside a sheet, swiping the sheet down only moved it to its smaller detent, and a tap behind it and the agent's back were refused: ModalHost.refusesDismissal treats the sheet's own route as inactive while something is pushed over it. NavigationHost.sheetDismissal goes back from the sheet's own route, as the Mac does (BackMac.swift dismiss): it presses the sheet's Back control if the app named one, and otherwise goes back to the route beneath the sheet. If the named Back control is disabled or missing, the dismissal is still refused. Upstream's web host already keeps a pushed route inside its sheet (b564083, 1f79f30), and its host/web/tests/sheet-detent.test.mjs covers it.
janicduplessis
force-pushed
the
@janic/web-push-in-sheet
branch
from
November 15, 2026 02:51
50b18c2 to
89ba45c
Compare
Author
|
I rebased this onto What changed in the rebase:
|
ccheever
added a commit
to expo/exact
that referenced
this pull request
Nov 15, 2026
Once a route was pushed inside a sheet, the sheet's own route was no longer the selected one, and ModalHost refused every dismissal of an inactive route: a swipe down only moved the sheet to its smaller detent, and a tap behind it and the agent's dismissal did nothing. NavigationHost.sheetBack now says how a sheet's dismissal goes back. With the sheet's own route selected it is that route's Back, as before. With routes pushed inside the sheet it is a history jump from the selected route to the route beneath the sheet (goBack(from:to:)), as a pop of several routes already is: the root's navigate with that location, else the runner's own back to it. A disabled navigationBack control on the selected route still refuses the dismissal. The sheet closes with what was pushed inside it, as LLP 1008 "Presented routes" and LLP 1115.001 have it and as the painted hosts already do. The test is from Janic Duplessis's fork (appandflow#8). The fork pressed the sheet's named Back control instead; one press pops only the top route while UIKit has already dismissed the sheet, so the jump does not press it, as a pop of several routes does not. Fixes #665. Co-authored-by: Janic Duplessis <janicduplessis@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Description
An app can push a route on the same stack after a sheet (
navigationPresentation="modal"), so the push happens inside the sheet. The common case is a menu sheet whose rows open Stats or Settings, with a Back control that returns to the menu. iOS shows the route on the sheet's ownUINavigationController, with the native back chevron. But once a route was pushed inside the sheet, swiping the sheet down did not close it; the sheet only moved to its smaller detent. Tapping the backdrop and the agent'sbackwere refused the same way.ModalHost.refusesDismissaltreats the sheet's own route as inactive while something is pushed over it, so it refused. Upstream has the same code.On the web, upstream already keeps a pushed route inside its sheet (expo/exact@b564083f4, expo/exact@1f79f30e), so this PR leaves the web host alone.
Solution
The new
NavigationHost.sheetDismissal(_:)dismisses from the sheet's own route while a route is pushed inside it, the way the Mac already does (BackMac.swiftdismiss). It presses the sheet's Back control if the app named one, and otherwise goes back to the route beneath the sheet. Swipe-down, the backdrop tap and the agent'sbackall use it, so the whole sheet goes. If the app named a Back control that is disabled or missing, the dismissal is still refused.sheetDismissallives inModalIOS.swift'sNavigationHostextension.selectedRouteinBackIOS.swiftis no longer private, for it. The contract docs get one table row (contract-for-agents.md), and the humans' guide now says iOS, like Android, closes the whole sheet on a drag down or a scrim tap.Test plan
bun host/apple/build.mjs --test --ios --only ModalStackIOSTestson an iOS 27.0 simulator, including the newtestDismissingASheetFromARoutePushedInsideItLeavesTheWholeSheet. All pass on the rebased branch. That test dismisses from the route pushed inside the sheet, then checks that the selected route is the one beneath the sheet and the background stack is unchanged.host/web/tests/sheet-detent.test.mjscovers the web side in Chrome, including a push inside a sheet. 9 pass.