Fix for Shell does not always raise Navigating event on Windows#28315
Merged
PureWeen merged 4 commits intodotnet:inflight/currentfrom Apr 22, 2025
Merged
Fix for Shell does not always raise Navigating event on Windows#28315PureWeen merged 4 commits intodotnet:inflight/currentfrom
PureWeen merged 4 commits intodotnet:inflight/currentfrom
Conversation
Contributor
|
Hey there @SuthiYuvaraj! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
jsuarezruiz
approved these changes
Mar 12, 2025
PureWeen
requested changes
Mar 12, 2025
| var currentItem = parentShell.CurrentItem?.CurrentItem; | ||
| if (currentItem?.Title != shellContent.Title && currentItem != shellContent.Parent) | ||
| { | ||
| (parentShell.CurrentItem as IShellItemController)?.ProposeSection(shellContent); |
Member
There was a problem hiding this comment.
Is there anywhere else we can call this so that the user can cancel the navigation?
The point of ProposeSection is to give the user time to cancel the navigation
Contributor
Author
There was a problem hiding this comment.
Hi @PureWeen ,
This issue is commonly observed in tab navigation and has not worked in previous cases. I have attached the relevant non-working scenarios, and a separate issue report (#28539) has been created for further investigation.
| Navigation Type | Status |
|---|---|
| TabBar – Tab – ShellContent | Navigating triggered without our fix , not able to cancel |
| TabBar – ShellContent | Navigating triggered after fix, not able to cancel |
| FlyoutItem – ShellContent | Navigating triggered after fix , not able to cancel |
PureWeen
pushed a commit
that referenced
this pull request
Apr 23, 2025
* Fix Changes and testcases * Update ShellItemHandler.Windows.cs * commit for label changes * Update ShellItemHandler.Windows.cs
github-actions bot
pushed a commit
that referenced
this pull request
Apr 28, 2025
* Fix Changes and testcases * Update ShellItemHandler.Windows.cs * commit for label changes * Update ShellItemHandler.Windows.cs
PureWeen
pushed a commit
that referenced
this pull request
May 2, 2025
* Fix Changes and testcases * Update ShellItemHandler.Windows.cs * commit for label changes * Update ShellItemHandler.Windows.cs
SuthiYuvaraj
added a commit
to SuthiYuvaraj/maui
that referenced
this pull request
May 9, 2025
…et#28315) * Fix Changes and testcases * Update ShellItemHandler.Windows.cs * commit for label changes * Update ShellItemHandler.Windows.cs
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Issue Details :
With TabBar and ShellContent, switching between the tabs does not raise the Navigating event on Windows.
Root Cause:
ShellContent is defined directly inside the TabBar. As a result, in
ShellItemHandler.windows.cs, theOnNavigationTabChangedmethod triggers the Navigating event forShellSection. However, since ShellContent is used directly, the Navigating event is not triggered becauseShellContentis directly set as the CurrentItem.On iOS and Android platforms, the Navigating event is directly invoked regardless of whether ShellSection or ShellContent is used.
Description of Fix:
The fix ensures that
ProposeSectionis invoked, which updates theNavigatingevent. This is done while considering that the CurrentItem is not the same asShellContent, ensuring proper event triggering and navigation handling.Issues Fixed
Fixes #12500
Output Screenshot
BeforeFix.mp4
AfterFix.mp4