[Windows] FlyoutPage: Fix CollapsedPaneWidth mapping and updates#33786
[Windows] FlyoutPage: Fix CollapsedPaneWidth mapping and updates#33786devanathan-vaithiyanathan wants to merge 7 commits intodotnet:mainfrom
Conversation
|
/azp run maui-pr-uitests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR fixes the FlyoutPage CollapsedPaneWidth property on Windows by implementing proper mapping from the MAUI property to the native NavigationView.CompactPaneLength property. The fix enables both initial and dynamic configuration of the collapsed pane width when using CollapseStyle.Partial.
Changes:
- Added property change callback to trigger handler updates when CollapsedPaneWidth changes
- Registered mapper for CollapsedPaneWidth property in FlyoutPage handler
- Implemented mapper to apply CollapsedPaneWidth to native NavigationView.CompactPaneLength
- Added UI test to verify CollapsedPaneWidth works both initially and when changed dynamically
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Controls/src/Core/PlatformConfiguration/WindowsSpecific/FlyoutPage.cs | Added property changed callback (OnCollapsedPaneWidthChanged) to trigger handler updates when CollapsedPaneWidth property changes |
| src/Controls/src/Core/FlyoutPage/FlyoutPage.Mapper.cs | Registered mapper for CollapsedPaneWidthProperty and implemented MapCollapsedPaneWidth to apply the value to NavigationView.CompactPaneLength |
| src/Controls/tests/TestCases.HostApp/Issues/Issue33785.cs | Created UI test page that demonstrates CollapsedPaneWidth functionality with initial value (50) and dynamic change (100) |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33785.cs | Implemented automated UI test that verifies CollapsedPaneWidth changes are applied correctly using screenshot verification |
| if (view is BindableObject bindable && handler.PlatformView is Microsoft.Maui.Platform.RootNavigationView navigationView) | ||
| { | ||
| var collapsedPaneWidth = PlatformConfiguration.WindowsSpecific.FlyoutPage.GetCollapsedPaneWidth(bindable); | ||
| if (collapsedPaneWidth > 0) |
There was a problem hiding this comment.
The validation condition if (collapsedPaneWidth > 0) is inconsistent with the property's validation which allows values >= 0. A value of 0 is valid according to the BindableProperty definition (line 70 in FlyoutPage.cs), but this mapper would skip applying it. Consider changing the condition to >= 0 or removing it entirely since the property already validates non-negative values. The default value is 48, so the typical case of 0 would represent "use default" behavior, which should probably still be applied to the platform control.
| if (collapsedPaneWidth > 0) | |
| if (collapsedPaneWidth >= 0) |
🤖 AI Summary📊 Expand Full Review —
|
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #33786 | Add dedicated Windows CollapsedPaneWidth mapper + propertyChanged callback |
❌ FAILED (Gate - missing baseline) | 4 files | Core logic appears correct; test fails due to missing VerifyScreenshot() baseline |
🔧 Fix — Analysis & Comparison
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| 1 | try-fix | Integrate CollapseStyle + CompactPaneLength into existing FlyoutBehavior mapper; also switch PaneDisplayMode to LeftCompact when CollapseStyle.Partial; replace VerifyScreenshot() with label assertion | ✅ PASS | 3 files | Reveals PR's critical bug: PR sets CompactPaneLength but stays in LeftMinimal mode where it has no effect |
| 2 | try-fix | Interface-based approach (IPartialCollapseView): FlyoutPage implements interface in Controls; Core FlyoutViewHandler.Windows.cs checks interface in MapFlyoutBehavior and applies LeftCompact + CompactPaneLength; label assertion test | ✅ PASS | 5 files | Architecturally cleaner Core/Controls boundary; also fixes PaneDisplayMode gap |
| 3 | try-fix | (pending) | ⏳ | - | - |
| 4 | try-fix | (pending) | ⏳ | - | - |
| PR | PR #33786 | Dedicated CollapsedPaneWidth mapper + propertyChanged callback; VerifyScreenshot() test | ❌ FAILED (Gate) | 4 files | Missing baseline snapshot; also misses PaneDisplayMode=LeftCompact needed for CompactPaneLength to work |
Cross-Pollination
| Model | Round | New Ideas? | Details |
|---|---|---|---|
| (pending round 2) | - | - | - |
Exhausted: No
Selected Fix: Pending all attempts
🤖 AI Summary📋 Expand PR Finalization ReviewPR #33786 Finalization ReviewTitle ReviewCurrent: Assessment: Acceptable, but it can be made more commit-history friendly by describing the implementation rather than the bug report. Recommended title: Description ReviewAssessment: The current description is directionally correct, but it is incomplete. What is good:
What is missing / should be improved:
Suggested description update:
Description of ChangeOn Windows, This PR wires A Windows UI test was added to cover both the initial partial-collapse setup and a runtime width change. Issues FixedFixes #33785 Platforms Tested
Code Review FindingsCritical Issues
var collapsedPaneWidth = PlatformConfiguration.WindowsSpecific.FlyoutPage.GetCollapsedPaneWidth(bindable);
navigationView.CompactPaneLength = collapsedPaneWidth;Suggestions
Looks Good
VerdictNot ready to merge as-is. The PR is very close, but the |
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 33786Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 33786" |
|
/azp run maui-pr-uitests |
|
Could you please add the Windows snapshot? :) |
|
Azure Pipelines successfully started running 1 pipeline(s). |
🚦 Gate — Test Verification📊 Expand Full Gate —
|
| # | Type | Test Name | Filter |
|---|---|---|---|
| 1 | UITest | Issue33785 | Issue33785 |
Verification
| Step | Expected | Actual | Result |
|---|---|---|---|
| Without fix | FAIL | FAIL | ✅ |
| With fix | PASS | FAIL | ❌ |
Test Execution
Without fix (expect FAIL):
- ✅ Issue33785: FAIL (1 total, 0 passed, 1 failed) — 533 s
- Failed:
VerifyFlyoutPageCollapsedPaneWidth [4 s] - Error:
VisualTestUtils.VisualTestFailedException : Baseline snapshot not yet created: D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\snapshots\windows\VerifyFlyoutPageCollapsedPaneWidt...
- Failed:
With fix (expect PASS):
- ❌ Issue33785: FAIL (1 total, 0 passed, 1 failed) — 439 s
- Failed:
VerifyFlyoutPageCollapsedPaneWidth [4 s] - Error:
VisualTestUtils.VisualTestFailedException : Baseline snapshot not yet created: D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\snapshots\windows\VerifyFlyoutPageCollapsedPaneWidt...
- Failed:
Fix Files Reverted
eng/pipelines/ci-copilot.ymlsrc/Controls/src/Core/FlyoutPage/FlyoutPage.Mapper.cssrc/Controls/src/Core/PlatformConfiguration/WindowsSpecific/FlyoutPage.cs
Base Branch: main | Merge Base: 720a9d4
kubaflo
left a comment
There was a problem hiding this comment.
Could you please add a snapshot?
|
@devanathan-vaithiyanathan okay! Merged |
Issue Details
The CollapsedPaneWidth value was not being properly applied to the native NavigationView.
Description of Change
On Windows, FlyoutPage.CollapsedPaneWidth was not being propagated to the native RootNavigationView, so changing the attached property had no effect on CompactPaneLength.
This PR wires PlatformConfiguration.WindowsSpecific.FlyoutPage.CollapsedPaneWidthProperty into the FlyoutPage mapper and applies the value to RootNavigationView.CompactPaneLength. It also adds a property-changed callback so runtime changes call Handler.UpdateValue(...) and update the native control after the handler is created.
A Windows UI test was added to cover both the initial partial-collapse setup and a runtime width change.
Note : FlyoutPage CollapsableStyle issue was resolved in PR #29927
Issues Fixed
Fixes #33785
Tested the behavior in the following platforms.
Before.mp4
After.mp4