Skip to content

Comments

Fix for Shell does not always raise Navigating event on Windows#28315

Merged
PureWeen merged 4 commits intodotnet:inflight/currentfrom
SuthiYuvaraj:fix-12500
Apr 22, 2025
Merged

Fix for Shell does not always raise Navigating event on Windows#28315
PureWeen merged 4 commits intodotnet:inflight/currentfrom
SuthiYuvaraj:fix-12500

Conversation

@SuthiYuvaraj
Copy link
Contributor

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, the OnNavigationTabChanged method triggers the Navigating event for ShellSection. However, since ShellContent is used directly, the Navigating event is not triggered because ShellContent is 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 ProposeSection is invoked, which updates the Navigating event. This is done while considering that the CurrentItem is not the same as ShellContent, ensuring proper event triggering and navigation handling.

Issues Fixed

Fixes #12500

Output Screenshot

Before Issue Fix After Issue Fix
BeforeFix.mp4
AfterFix.mp4

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Mar 11, 2025
@dotnet-policy-service
Copy link
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.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Mar 11, 2025
@jsuarezruiz jsuarezruiz added the area-controls-shell Shell Navigation, Routes, Tabs, Flyout label Mar 11, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@SuthiYuvaraj SuthiYuvaraj marked this pull request as ready for review March 12, 2025 12:35
@SuthiYuvaraj SuthiYuvaraj requested a review from a team as a code owner March 12, 2025 12:35
var currentItem = parentShell.CurrentItem?.CurrentItem;
if (currentItem?.Title != shellContent.Title && currentItem != shellContent.Parent)
{
(parentShell.CurrentItem as IShellItemController)?.ProposeSection(shellContent);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

@SuthiYuvaraj SuthiYuvaraj Mar 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 PureWeen changed the base branch from main to inflight/current April 22, 2025 22:18
@PureWeen PureWeen merged commit a217afc into dotnet:inflight/current Apr 22, 2025
131 checks passed
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
@github-actions github-actions bot locked and limited conversation to collaborators May 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-shell Shell Navigation, Routes, Tabs, Flyout community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shell does not always raise Navigating event on Windows

3 participants