Skip to content

fix(navview): Keep overflow button after overflow selection - #23906

Merged
ramezgerges merged 1 commit into
unoplatform:masterfrom
ramezgerges:dev/rara/navview-overflow-button
Jul 30, 2026
Merged

ramezgerges merged 1 commit into
unoplatform:masterfrom
ramezgerges:dev/rara/navview-overflow-button

Conversation

@ramezgerges

Copy link
Copy Markdown
Contributor

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.SelectOverflowItem moves 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; OnOverflowItemsSourceCollectionChanged reacts to that transient state by collapsing the overflow button, and nothing re-shows it afterwards (the subsequent measure pass doesn't reach ArrangeTopNavItems, the only place that sets it back to Visible).

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_Remains mirrors 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. Full Given_NavigationView (27) and MUX NavigationViewTests (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 ✅

🤖 Generated with Claude Code

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]>
Copilot AI review requested due to automatic review settings July 29, 2026 16:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.SelectOverflowItem to 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 + MenuItemTemplate and 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.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 224779 has failed on Uno.UI - CI.

@mergify

mergify Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@ramezgerges
ramezgerges merged commit aecaddf into unoplatform:master Jul 30, 2026
47 checks passed
@ramezgerges
ramezgerges deleted the dev/rara/navview-overflow-button branch July 30, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The visibility of the NavigationView overflow button is not calculated correctly

5 participants