Fix OnNavigatedTo not firing after PopModalAsync when tab is changed inside modal#35768
Merged
Conversation
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 35768Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 35768" |
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
This was referenced Jun 4, 2026
Open
kubaflo
approved these changes
Jun 5, 2026
This was referenced Jun 6, 2026
This was referenced Jun 11, 2026
PureWeen
added a commit
that referenced
this pull request
Jun 11, 2026
The classifier picked the newest cross-referenced PR from the issue timeline without first checking whether the SR already had a fix from a different PR. This caused issues that were fixed by SR-direct PRs (e.g. #35768 against release/10.0.1xx-sr7) to be reported as 'open-on-main' needing backport, when in fact the forward-flow main companion PR (e.g. #35803) just happened to also close the issue. Real example from SR8 dogfood: issue #35756 → fixed by #35768 (merged to SR7, inherited by SR8) misclassified as 'open-on-main' because #35803 (the forward-flow main PR) is OPEN Should be: 'in-sr-active' — no action needed Fix: before the candidate-PR walk, check srContents.fixedIssues (the deterministic closing-keyword ground truth from SR commits). If the issue appears there, classify based on the SR commit's PR number, with revert-awareness. + 8 new assertions covering the SR-direct-fix path, the reverted-on-SR edge case, and backward compat with partial SrContents shape. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Jun 12, 2026
This was referenced Jun 15, 2026
Open
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.
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!
Root Cause
When a modal is closed through
PopModalAsync, the framework cascadesSendNavigatedTo(Pop)down to the current child of theTabbedPage(for example,Tab1). InsideSendNavigatedTo, a guard (if (HasNavigatedTo) return) prevents duplicateOnNavigatedToevents from firing. This guard was introduced in PR #31931 to fix issue #23902 .The issue occurs when the user switches tabs while a modal is open. That tab switch triggers a normal
Replacenavigation within theTabbedPage, which setsTab1.HasNavigatedTo = true. Later, when the modal is closed,SendNavigatedFromis invoked only on the modal page itself — the tab child pages never receiveSendNavigatedFrom, so theirHasNavigatedToflags are not reset.As a result, when the subsequent
Popcascade reachesTab1, itsHasNavigatedToflag is stilltruefrom the earlier in-modal tab switch. The duplicate-event guard therefore incorrectly suppresses theOnNavigatedToevent that should fire when returning to the page after the modal closes.Description of Change
Updated
Page.SendNavigatedToso that when navigation cascades into a container child page, the child’sHasNavigatedToflag is reset before cascading — but only forNavigationType.Pop.Poprepresents returning to an existing page and should always trigger a legitimate newOnNavigatedToevent.PushandReplaceflows remain unchanged, preserving the original duplicate-event protection introduced for issue #23902.Regression details
The regression was introduced by PR #31931
Issues Fixed
Fixes #35756
Tested the behaviour in the following platforms
Screenshots
BeforeFix.mov
AfterFix.mov