Skip to content

Commit

Permalink
fix: NavigationView selection indicator unreliable for minimal displa…
Browse files Browse the repository at this point in the history
…y mode
  • Loading branch information
MartinZikmund committed Mar 8, 2022
1 parent 9243b2b commit 25e99af
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,21 @@ internal void OnNavigationViewItemInvoked(NavigationViewItem nvi)

if (updateSelection)
{
var indicatorTarget = nvi;

// Move indicator to topmost collapsed parent
var parent = GetParentNavigationViewItemForContainer(nvi);
while (parent != null)
{
if (!parent.IsExpanded)
{
indicatorTarget = parent;
}
parent = GetParentNavigationViewItemForContainer(parent);
}

AnimateSelectionChanged(indicatorTarget);

CloseFlyoutIfRequired(nvi);
}
}
Expand Down Expand Up @@ -1390,7 +1405,10 @@ int GetChildDepth(NavigationViewRepeaterPosition position, NavigationViewItemBas
// TODO: Uno specific - remove when #4689 is fixed
// This ensures the item is properly initialized and the selected item is displayed
nvibImpl.Reinitialize();
AnimateSelectionChanged(SelectedItem);
if (SelectedItem != null && m_activeIndicator == null)
{
AnimateSelectionChanged(SelectedItem);
}
#endif
}
}
Expand Down

0 comments on commit 25e99af

Please sign in to comment.