Skip to content

[Windows] Fix Flyout/Locked mode header collapse regression causing UI test failures on candidate branch - #35340

Merged
kubaflo merged 1 commit into
dotnet:inflight/currentfrom
kubaflo:recreate-pr-35312-inflight-current
May 7, 2026
Merged

[Windows] Fix Flyout/Locked mode header collapse regression causing UI test failures on candidate branch#35340
kubaflo merged 1 commit into
dotnet:inflight/currentfrom
kubaflo:recreate-pr-35312-inflight-current

Conversation

@kubaflo

@kubaflo kubaflo commented May 7, 2026

Copy link
Copy Markdown
Collaborator

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/candidate instead of inflight/current. The candidate-side merge was reverted by #35339; this PR re-targets the same fix to inflight/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.

  • ModalPageBackgroundShouldBeTransparent

Added snapshots:

Additionally, the updated snapshot for #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
…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
@kubaflo
kubaflo merged commit 5f47a27 into dotnet:inflight/current May 7, 2026
2 of 11 checks passed
@github-actions github-actions Bot added this to the .NET 10 SR7 milestone May 7, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants