From 342a66b9e21e619c9192a4bd63bb2f32563c2e20 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 6 Feb 2025 14:39:11 +0900 Subject: [PATCH] Fix keyboard traversal on a collapsed group not working as intended --- osu.Game/Screens/SelectV2/Carousel.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/SelectV2/Carousel.cs b/osu.Game/Screens/SelectV2/Carousel.cs index 608ef207d9..6b7b1f3a9b 100644 --- a/osu.Game/Screens/SelectV2/Carousel.cs +++ b/osu.Game/Screens/SelectV2/Carousel.cs @@ -378,7 +378,7 @@ namespace osu.Game.Screens.SelectV2 { 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) return; } @@ -386,20 +386,20 @@ namespace osu.Game.Screens.SelectV2 int originalIndex; int newIndex; - if (currentSelection.Index == null) + if (currentKeyboardSelection.Index == null) { // If there's no current selection, start from either end of the full list. newIndex = originalIndex = direction > 0 ? carouselItems.Count - 1 : 0; } 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, // 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) { - while (!CheckValidForGroupSelection(carouselItems[newIndex])) + while (newIndex > 0 && !CheckValidForGroupSelection(carouselItems[newIndex])) newIndex--; } }