Repository navigation
fix(navview): Keep overflow button after overflow selection - #23906
Conversation
In Top mode, selecting an item from the overflow flyout could permanently collapse the overflow button even though not all items fit. The two-phase exchange in SelectOverflowItem moved items into the primary list before moving others out, transiently emptying the overflow list; OnOverflowItemsSourceCollectionChanged reacted to that transient state by collapsing the button, and nothing re-showed it afterwards. Reorder the exchange (move out of primary first) so the overflow list only becomes empty when it genuinely ends empty. Inherited from WinUI (open upstream bug microsoft/microsoft-ui-xaml#6626) - native WinAppSDK fails the same scenario, so the runtime test is Skia-only. fixes unoplatform#23903 Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR fixes a NavigationView Top-mode overflow scenario where selecting an item from the overflow flyout could collapse the overflow button permanently, making remaining overflow items unreachable until a resize cycle. The change aligns item-exchange ordering to avoid a transient “overflow list empty” state that triggers the collapse.
Changes:
- Reordered the Primary/Overflow exchange in
NavigationView.SelectOverflowItemto move items out of the primary list before moving items into it. - Added a Skia Desktop runtime test that reproduces the overflow-button-disappearing scenario using
MenuItemsSource+MenuItemTemplateand input injection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Uno.UI/UI/Xaml/Controls/NavigationView/NavigationView.cs | Reorders the overflow/primary exchange to prevent the overflow button from collapsing due to transient empty overflow state. |
| src/Uno.UI.RuntimeTests/Tests/Microsoft_UI_Xaml_Controls/Given_NavigationView.cs | Adds a Skia-only runtime test that validates the overflow button remains visible after selecting an overflow item across multiple window widths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23906/wasm-skia-net9/index.html |
|
|
|
Tick the box to add this pull request to the merge queue (same as
|
GitHub Issue: closes #23903
PR Type:
🐞 Bugfix
What changed? 🚀
In Top mode, selecting an item from the overflow flyout could permanently collapse the overflow button even though not all items fit in the top bar, leaving the remaining items unreachable until the window was resized wider and back.
Root cause: the two-phase exchange in
NavigationView.SelectOverflowItemmoves items into the primary list before moving others out. When the selected item is the only overflow item, the overflow list transiently empties mid-exchange;OnOverflowItemsSourceCollectionChangedreacts to that transient state by collapsing the overflow button, and nothing re-shows it afterwards (the subsequent measure pass doesn't reachArrangeTopNavItems, the only place that sets it back toVisible).Fix: reorder the exchange to move items out of the primary list first, so the overflow list only becomes empty when it genuinely ends empty (in which case collapsing is correct). Marked as an Uno workaround, since this is an inherited WinUI bug (microsoft/microsoft-ui-xaml#6626, open since 2022) — running the same repro test against native WinAppSDK fails the same way, which is why the new runtime test is Skia-only.
Validation (runtime): new runtime test
Given_NavigationView.When_TopNav_Select_Overflow_Item_Overflow_Button_Remainsmirrors the issue's repro (MenuItemsSource + MenuItemTemplate, gradual width shrink, InputInjector taps on the overflow button and flyout item across 10 widths) — fails at 6 widths before the fix, passes after. FullGiven_NavigationView(27) and MUXNavigationViewTests(14) suites pass on Skia Desktop. Also validated manually with the issue's attached repro app (stock 6.5.31 reproduces; local build with the fix does not).PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code