Skip to content

Commit 25e99af

Browse files
committed
fix: NavigationView selection indicator unreliable for minimal display mode
1 parent 9243b2b commit 25e99af

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/Uno.UI/Microsoft/UI/Xaml/Controls/NavigationView/NavigationView.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,21 @@ internal void OnNavigationViewItemInvoked(NavigationViewItem nvi)
11681168

11691169
if (updateSelection)
11701170
{
1171+
var indicatorTarget = nvi;
1172+
1173+
// Move indicator to topmost collapsed parent
1174+
var parent = GetParentNavigationViewItemForContainer(nvi);
1175+
while (parent != null)
1176+
{
1177+
if (!parent.IsExpanded)
1178+
{
1179+
indicatorTarget = parent;
1180+
}
1181+
parent = GetParentNavigationViewItemForContainer(parent);
1182+
}
1183+
1184+
AnimateSelectionChanged(indicatorTarget);
1185+
11711186
CloseFlyoutIfRequired(nvi);
11721187
}
11731188
}
@@ -1390,7 +1405,10 @@ int GetChildDepth(NavigationViewRepeaterPosition position, NavigationViewItemBas
13901405
// TODO: Uno specific - remove when #4689 is fixed
13911406
// This ensures the item is properly initialized and the selected item is displayed
13921407
nvibImpl.Reinitialize();
1393-
AnimateSelectionChanged(SelectedItem);
1408+
if (SelectedItem != null && m_activeIndicator == null)
1409+
{
1410+
AnimateSelectionChanged(SelectedItem);
1411+
}
13941412
#endif
13951413
}
13961414
}

0 commit comments

Comments
 (0)