Skip to content

NavigationView retains selected ancestors after child reparenting #24508

Open

Description

@YoungSx

Current behavior 🐛

Moving the selected data item between hierarchical NavigationView groups can leave IsChildSelected set on its former ancestors. Collapsing an unrelated former parent then moves the selection indicator to that group although SelectedItem still identifies the original leaf. Selecting a root item can also set its own IsChildSelected flag.

Expected behavior 🎯

Only the current ancestors of the selected item report IsChildSelected. Removing selection or recycling an ancestor clears the flag. Collapsing an unrelated group does not take the selected leaf's indicator.

How to reproduce it (as minimally and precisely as possible) 🔬

  1. Bind a left NavigationView to two groups with ObservableCollection child sources and expanded NavigationViewItem containers.
  2. Select a leaf under the first group.
  3. Remove that same data object from the first collection, add it to the second, and set SelectedItem to that object.
  4. Collapse the first group.
  5. Observe the indicator on the unrelated group while SelectedItem remains the leaf in the second group.

The accompanying PR contains runtime tests with the complete minimal setup, plus cases for insertion before a selected ancestor, three-level hierarchy, pane-mode rebinding, clearing selection and a collapsed destination.

Workaround 🛠️

No application-side mutation of IsSelected or IsChildSelected is used.

Renderer 🎨

  • Skia
  • Native

Affected platforms 📱💻🖥️

Desktop (X11), reproduced with the real NavigationView tree. Other platforms have not been runtime-validated for this report.

Uno.Sdk version (and other relevant versions) 📦

Uno.Sdk 6.7.22 / Uno.WinUI 6.7.103 (source cd452e3ee242c9a2a8dee5e65ad8088b6f5dbf83). The stale-index cleanup is also present on current master 0a4053a40b7bc7fe5f7a0ef5aaa890c5cd5e7a6d and current release/stable/6.7 by source inspection.

IDE version 🧑‍💻

.NET CLI 10.0.400 on Linux x64.

Anything else we need to know? 💬

A development build of the equivalent fix at the 6.7.103 source passed 27 collection-migration steps and 96 realized-container samples, followed by native pointer collapse, keyboard activation and focus-release migration. This is a source-built development comparison, not a published package validation. Full upstream runtime CI remains required.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions