Skip to content

Fix OnNavigatedTo not firing after PopModalAsync when tab is changed inside modal#35768

Merged
kubaflo merged 1 commit into
release/10.0.1xx-sr7from
fix-35756
Jun 5, 2026
Merged

Fix OnNavigatedTo not firing after PopModalAsync when tab is changed inside modal#35768
kubaflo merged 1 commit into
release/10.0.1xx-sr7from
fix-35756

Conversation

@praveenkumarkarunanithi

Copy link
Copy Markdown
Contributor

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 cascades SendNavigatedTo(Pop) down to the current child of the TabbedPage (for example, Tab1). Inside SendNavigatedTo, a guard (if (HasNavigatedTo) return) prevents duplicate OnNavigatedTo events 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 Replace navigation within the TabbedPage, which sets Tab1.HasNavigatedTo = true. Later, when the modal is closed, SendNavigatedFrom is invoked only on the modal page itself — the tab child pages never receive SendNavigatedFrom, so their HasNavigatedTo flags are not reset.

As a result, when the subsequent Pop cascade reaches Tab1, its HasNavigatedTo flag is still true from the earlier in-modal tab switch. The duplicate-event guard therefore incorrectly suppresses the OnNavigatedTo event that should fire when returning to the page after the modal closes.

Description of Change

Updated Page.SendNavigatedTo so that when navigation cascades into a container child page, the child’s HasNavigatedTo flag is reset before cascading — but only for NavigationType.Pop.

Pop represents returning to an existing page and should always trigger a legitimate new OnNavigatedTo event. Push and Replace flows 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

  • Android
  • Windows
  • iOS
  • Mac

Screenshots

Before Issue Fix After Issue Fix
BeforeFix.mov
AfterFix.mov

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 35768

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 35768"

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jun 4, 2026
@praveenkumarkarunanithi praveenkumarkarunanithi added platform/macos macOS / Mac Catalyst platform/windows platform/android platform/ios i/regression This issue described a confirmed regression on a currently supported version and removed partner/syncfusion Issues / PR's with Syncfusion collaboration labels Jun 4, 2026
@praveenkumarkarunanithi praveenkumarkarunanithi marked this pull request as ready for review June 4, 2026 14:16
@vishnumenon2684

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-tabbedpage TabbedPage i/regression This issue described a confirmed regression on a currently supported version platform/android platform/ios platform/macos macOS / Mac Catalyst platform/windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants