1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 02:43:01 +08:00

Fix keyboard traversal on a collapsed group not working as intended

This commit is contained in:
Dean Herbert 2025-02-06 14:39:11 +09:00
parent 88ad87a78e
commit 342a66b9e2
No known key found for this signature in database

View File

@ -378,7 +378,7 @@ namespace osu.Game.Screens.SelectV2
{ {
TryActivateSelection(); TryActivateSelection();
// There's a chance this couldn't resolve, at which point continue with standard traversal. // Is the selection actually changed, then we should not perform any further traversal.
if (currentSelection.CarouselItem == currentKeyboardSelection.CarouselItem) if (currentSelection.CarouselItem == currentKeyboardSelection.CarouselItem)
return; return;
} }
@ -386,20 +386,20 @@ namespace osu.Game.Screens.SelectV2
int originalIndex; int originalIndex;
int newIndex; int newIndex;
if (currentSelection.Index == null) if (currentKeyboardSelection.Index == null)
{ {
// If there's no current selection, start from either end of the full list. // If there's no current selection, start from either end of the full list.
newIndex = originalIndex = direction > 0 ? carouselItems.Count - 1 : 0; newIndex = originalIndex = direction > 0 ? carouselItems.Count - 1 : 0;
} }
else else
{ {
newIndex = originalIndex = currentSelection.Index.Value; newIndex = originalIndex = currentKeyboardSelection.Index.Value;
// As a second special case, if we're group selecting backwards and the current selection isn't a group, // As a second special case, if we're group selecting backwards and the current selection isn't a group,
// make sure to go back to the group header this item belongs to, so that the block below doesn't find it and stop too early. // make sure to go back to the group header this item belongs to, so that the block below doesn't find it and stop too early.
if (direction < 0) if (direction < 0)
{ {
while (!CheckValidForGroupSelection(carouselItems[newIndex])) while (newIndex > 0 && !CheckValidForGroupSelection(carouselItems[newIndex]))
newIndex--; newIndex--;
} }
} }