[Windows] Fix Flyout/Locked mode header collapse regression causing UI test failures on candidate branch - #35340
Merged
kubaflo merged 1 commit intoMay 7, 2026
Conversation
…I test failures on candidate branch (dotnet#35312) <!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Root cause PR dotnet#30382 introduced AlwaysShowHeader = false in the RootNavigationView constructor to fix Issue dotnet#30254 (blank header space in the Shell flyout). However, this was applied unconditionally across all NavigationView display modes. In the scenario from Issue2740 (FlyoutPage with FlyoutBehavior.Locked), the PaneDisplayMode is Left, not LeftMinimal. Because AlwaysShowHeader was set to false, WinUI’s NavigationView collapsed the header whenever the Header became temporarily null during page transitions. As a result, toolbar items (e.g., the Switch button) were removed from the UI Automation tree, causing the test to fail. ### Description of Change The fix updates AlwaysShowHeader dynamically based on the current PaneDisplayMode within the PaneDisplayModeChangedhandler: AlwaysShowHeader = PaneDisplayMode != NavigationViewPaneDisplayMode.LeftMinimal; This ensures: • AlwaysShowHeader = false only for LeftMinimal mode (Shell Flyout), preserving the fix for Issue dotnet#30254. • AlwaysShowHeader = true for all other modes (e.g., Left / FlyoutBehavior.Locked), ensuring the header remains visible and toolbar items stay accessible in the UI Automation tree. Also added the updated snapshot for the dotnet#30382. ### Issues Fixed - Regression introduced by PR dotnet#30382 ### Resaved Test snapshots The below-mentioned test case was resaved because the ContentPage did not have a title. Based on the fix, the currently generated image is the expected image, so the test snapshot has been resaved accordingly, similar to [dotnet#30382](dotnet#30382). - ModalPageBackgroundShouldBeTransparent **Added snapshots:** Additionally, the updated snapshot for [dotnet#30382](dotnet#30382) has also been added for the Mac and Windows platforms. - ShouldHideHeaderWhenTitleEmpty - ShouldShowHeaderWhenTitleNotEmpty ### Failure test cases - VerifyFlyoutVerticalScrollModeDisabled - VerifyFlyoutPageToolbarItemsRender - ShouldFlyoutBeVisibleAfterMaximizingWindow - FlyoutItemTextShouldDisplayProperly - VerifyShellMenuItemsAlignedInRTL - TestB43527UpdateTitle - TitleUpdatesAfterShowingNonFlyoutPage - WhenFlyoutIsLockedButtonsAreStillVisible - Issue2740Test - NavigationPageTitle - DoNotAccessDisposedCollectionView
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.
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!
Recreates #35312, which was accidentally merged into
inflight/candidateinstead ofinflight/current. The candidate-side merge was reverted by #35339; this PR re-targets the same fix toinflight/current.Original author: @BagavathiPerumal
Root cause
PR #30382 introduced AlwaysShowHeader = false in the RootNavigationView constructor to fix Issue #30254 (blank header space in the Shell flyout). However, this was applied unconditionally across all NavigationView display modes.
In the scenario from Issue2740 (FlyoutPage with FlyoutBehavior.Locked), the PaneDisplayMode is Left, not LeftMinimal. Because AlwaysShowHeader was set to false, WinUI's NavigationView collapsed the header whenever the Header became temporarily null during page transitions. As a result, toolbar items (e.g., the Switch button) were removed from the UI Automation tree, causing the test to fail.
Description of Change
The fix updates AlwaysShowHeader dynamically based on the current PaneDisplayMode within the PaneDisplayModeChanged handler:
AlwaysShowHeader = PaneDisplayMode != NavigationViewPaneDisplayMode.LeftMinimal;
This ensures:
Also added the updated snapshot for the #30382.
Issues Fixed
Resaved Test snapshots
The below-mentioned test case was resaved because the ContentPage did not have a title. Based on the fix, the currently generated image is the expected image, so the test snapshot has been resaved accordingly, similar to #30382.
Added snapshots:
Additionally, the updated snapshot for #30382 has also been added for the Mac and Windows platforms.
Failure test cases