Repository navigation
Conversation
Resolve the native navigation controller through IPlatformViewHandler and invoke the exported navbar callback for either implementation. Keep all back policy and exactly-once assertions unchanged for a hosted baseline control. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 90f92de8-cceb-42c6-89e1-42b0d7e90c0f
Evaluate back policy once when admitting a gesture, reuse that decision for the navbar callback, and clear it on navigation completion, disappearance, stack changes and disconnect. Add handler-neutral admission, callback-reset and native back-button coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 90f92de8-cceb-42c6-89e1-42b0d7e90c0f
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39574Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39574" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🔵 Needs a closer look
Physical canceled-swipe behavior and shared MacCatalyst behavior remain unverified and warrant human review despite the reported iOS test results.
No open issues 🎉
What changed in this PR
Extends the back-navigation policy fix from #38071 to the modern NavigationViewHandler on net11.0, allowing pages to veto interactive pop gestures before UIKit starts navigation.
Changes:
- Evaluates back policy during gesture admission and reuses accepted decisions to avoid duplicate callbacks.
- Clears pending admission on navigation completion, disappearance, stack changes, and disposal.
- Makes device tests handler-independent and adds native back-button and cancellation-reset coverage.
| File | Description |
|---|---|
src/Core/src/Platform/iOS/NavigationControllerManager/NavigationControllerManager.cs |
Enforces gesture back policy and manages pending admission state. |
src/Controls/tests/DeviceTests/Elements/NavigationPage/NavigationPageTests.iOS.cs |
Tests policy enforcement, callback counts, and reset behavior across handlers. |
Review effort: Balanced
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
/review expert-review |
This comment has been minimized.
This comment has been minimized.
PR Test Gate🧪 Gate analysis — click to expand⚠ Inconclusive. Setup, build, or execution did not produce a conclusive result. This does not prove the fix is incorrect. 📱 Device tests
Execution log excerptsWithout fix With fix PR head: 7a9b331b. Without-fix baseline: 4ef2769e. |
There was a problem hiding this comment.
Expert Review — 0 findings
Reviewed commit 7a9b331.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
Fix the modern
NavigationViewHandlerinteractive-pop path on the explicitly requested net11.0 branch.NavigationControllerManager.GestureDelegate.ShouldBeginchecked the native stack depth but never consultedINavigationManagerDelegate.ShouldPop, so a page handlingOnBackButtonPressedcould not veto the gesture.The manager now evaluates the existing back policy during gesture admission and reuses an accepted decision for UIKit's subsequent navbar callback, calling the application only once. Pending admission is cleared on navigation completion (including return to the original controller), disappearance, managed stack changes and disconnect. Root-stack rejection is retained and disconnected managers reject gesture admission. This follows the legacy renderer's completion/reset model without adding a new public API or a Controls dependency to Core.
The inherited device tests now obtain
UINavigationControllerthroughIPlatformViewHandler, rather than requiringNavigationRenderer. They assert the callback count both immediately after admission and after the navbar callback. Additional theories cover actual native back-button allow/veto behavior and re-evaluating changed policy after returning to the current controller. Forcing the legacy renderer in the derived fixture would hide the product defect; evaluating policy independently in both callbacks would invoke application code twice.This is the modern-manager follow-up to #38071, which changed the legacy NavigationRenderer/Shell paths, not
NavigationControllerManager. No GC helpers, tolerances, XAML implementation, dependency pins or pipeline configuration are changed.Validation
Supported hosted iOS CoreCLR: exact candidate
7a9b331b63781ab16e23c8f3ff1021f8b6130cbapassed scoped build 1645892. Only the CoreCLR build and iOS Helix stages were selected; the seven other stages were confirmed completed/skipped. Actual uploaded xUnit XML was inspected, not just the pipeline result.osx.15.arm64.maui.openosx.26.arm64.openThe 32 cases per queue include both boolean variants of the two original theories and the two added theories across the base renderer, modern navigation handler, Flyout-handler and Tabbed-handler fixtures. None of these target cases was skipped.
The fixture-routing-only old-product control, build 1645755 at
a4e530270296d7b0fa8289d14fa0c4cae6737623, exposed two underlying admission failures per queue: the modern handler returned true for handled back requests with either hidden or visible navigation bars. The other original variants passed. This is distinct from the earlier wrong-handler-type failure.Additional limited local Mono causal controls: on an owned headless iPhone 11 Pro / iOS 26.5 simulator, with the final test source unchanged throughout, each arm ran three times:
All 58 test identities and the six failing identities/messages were reconciled across the 12 fresh XML files. The strengthened fixture detects four modern admission/callback failures plus two return/reset admission failures; it is therefore not described as the same suite/count as the older hosted routing-only control. Native back-button cases and legacy renderer controls pass in both red and green arms.
Local commands, using the pinned .NET SDK
11.0.100(11.0.100-rtm.26514.118) and iOS workload27.0.12230:Result: all four app rebuilds passed, with two existing warnings (
MAUI1001and the obsolete CollectionView handler warning). The Mono opt-in matches the existing CI smoke configuration. The local host has Xcode 26.6; the documented Xcode-version override is limited compatibility evidence, not supported-Xcode-27 certification. No linker/header/trimming bypass or dependency downgrade was used. The local CoreCLR app attempt failed withMT180; CoreCLR execution evidence comes from the supported hosted run above.Each fresh arm/repetition used this XHarness command shape (
$HEADLESS_MLAUNCHinvokes the pinned bundled mlaunch with--quiet-simulator;$FRESH_OUTPUTis a new directory):Results: exit 1 with the six intended failures in every original/reverted run; exit 0 with 58/58 passing in every fixed/restored run. These were manual, constrained native controls, not a claim that the generic verification script emitted
VERIFICATION PASSED.Coverage limits: the return-to-current-controller test invokes the native
DidShowViewControllerdelegate callback; it is a cancellation-lifecycle control, not a physical canceled-swipe input test. No XCTest, Simulator GUI, host desktop UI automation, or MacCatalyst/Android/Windows test execution was used. The owned simulator was shut down afterward. The shared UIKit implementation also affects MacCatalyst, but native MacCatalyst execution is not claimed.Ancestry/current-base limit: this branch and both hosted controls are based on
b039b2b4bfd7fe2ffc024457af9c64265f1517d6, not the newer7b0ea7800db3f3faccbaecb665d32b7c61eaf932. Neither edited file has a delta between those bases. The newer-base build 1645823 separately reports EssentialsCA1416errors in ImageProcessor/Passkeys. Those files are outside this PR; the successful scoped candidate run is not whole-current-base certification. No merge or rebase was used to obscure that distinction.Issues Fixed
Related to #37781 and the pre-existing net11.0 navigation failures observed while validating #39536. This is a separate focused product fix; #39536 and its GC fixture are unchanged. No issue or unrelated PR is automatically closed by this description.