Repository navigation
Description
What happened
Since #326, a route pushed after a sheet (navigationPresentation="modal") is shown inside that sheet, on the sheet's own UINavigationController with the system Back. On iOS, once such a route is pushed, the sheet can no longer be dismissed:
- swiping the sheet down only moves it to its smaller detent;
- a tap on the backdrop does nothing;
- the agent's
backon the sheet is refused.
The humans' guide says that on Android a drag down or a scrim tap closes the sheet with what was pushed inside it. #326 also asked for dismissal to close the whole sheet. On the Mac, BackMac.swift's dismiss already does this.
Steps: open Menu, tap Settings (pushed inside the sheet), then swipe the sheet down.
Cause
ModalHost.refusesDismissal (host/apple/Sources/ExactKit/IOS/ModalIOS.swift) refuses when presenter.navigation.isInactiveRoute(containing: route). While a route is pushed inside the sheet, the sheet's own route counts as inactive, so presentationControllerShouldDismiss, dismissByBackdrop and the agent's back all refuse.
How a fork fixed it
appandflow/exact#8 adds NavigationHost.sheetDismissal(_ sheet:), which returns how to dismiss from the sheet's own route while a route pushed inside it is selected, as the Mac does:
- if the app named a Back control (
navigationBack) inside the sheet, it presses that control; - otherwise it goes back from the selected route to the route beneath the sheet (
goBack(from:to:)); - if the named Back control is disabled or missing, it returns
niland the dismissal is still refused.
refusesDismissal consults it for an inactive sheet route instead of refusing outright. The swipe-down completion, dismissByBackdrop and the agent's back call it in place of invokeBack(from:). The swipe-down path reads it before closeTop runs, while the sheet's navigation still holds the pushed route. selectedRoute in BackIOS.swift is no longer private, for this. The contract docs get one table row, and the humans' guide says iOS, like Android, closes the whole sheet on a drag down or a scrim tap.
The test ModalStackIOSTests.testDismissingASheetFromARoutePushedInsideItLeavesTheWholeSheet dismisses from the pushed route, then checks that the selected route is the one beneath the sheet and the background stack is unchanged. The web host already keeps a pushed route inside its sheet, so the fork did not change it.
Host
iOS
Smallest app that shows it
routes nav
home "/"
menu "/menu"
settings "/menu/settings"
component App
action follow(url: string)
nav = go(nav, url)
action back
nav = back(nav)
view
main navigationKey=`${top(nav).id}` navigationBack="back" navigate=follow width="100%" height="100%"
for e in stack(nav) key=e.id
if e.name == "home"
column navigationKey=`${e.id}` position="absolute" inset=0 padding=16
link href="/menu" testId="open-menu"
text "Menu"
if e.name == "menu"
column navigationKey=`${e.id}` navigationPresentation="modal" navigationDetent="medium large" position="absolute" inset=0 padding=16
link href="/menu/settings" testId="open-settings"
text "Settings"
if e.name == "settings"
column navigationKey=`${e.id}` position="absolute" inset=0 padding=16
text "Settings"
This snippet compiles. The behaviour was seen in an app with the same structure on an iOS 27.0 simulator.
Exact commit
Seen on a fork based on a107143. refusesDismissal on upstream main at f3a4ace is unchanged.
Activity
ccheever commentedon Nov 15, 2026
Fixed in f1d3819, with Janic Duplessis credited (appandflow#8). The swipe down, the tap behind the sheet and the agent's dismissal now all go through one path,
NavigationHost.sheetBack(from:).navigateif it has one, otherwise the runner's own back.navigationBackcontrol on the selected route still refuses the dismissal.This differs from the fork on one point. Pressing the sheet's named Back control pops only the top route, but UIKit has already dismissed the whole sheet, so the app's state and the screen would disagree. A named Back control is therefore skipped here, as it already is when Back pops several routes. Checked on a simulator with the issue's snippet: Menu, then Settings pushed inside the sheet, then a real swipe down closed the whole sheet and returned to
/. The fork'sModalStackIOSTestscase passes. One correction to the report: the agent'sbackon a pushed route was never refused. It pops the route inside the sheet first, which is correct.Posted by Claude Code on the maintainers' behalf.
A sheet dismissed on iOS with routes pushed inside it closes whole