mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-15 11:20:36 +08:00
Focus the last menu item on ArrowUp
With nothing focused yet, ArrowUp landed on the second to last item.
This commit is contained in:
@@ -8,7 +8,7 @@ export function menuFocusIndex(
|
||||
case "ArrowDown":
|
||||
return wrap(current + 1);
|
||||
case "ArrowUp":
|
||||
return wrap(current - 1);
|
||||
return current === -1 ? count - 1 : wrap(current - 1);
|
||||
case "Home":
|
||||
return 0;
|
||||
case "End":
|
||||
|
||||
@@ -6,6 +6,7 @@ test.each([
|
||||
["ArrowDown", -1, 0],
|
||||
["ArrowDown", 0, 1],
|
||||
["ArrowDown", 2, 0],
|
||||
["ArrowUp", -1, 2],
|
||||
["ArrowUp", 0, 2],
|
||||
["ArrowUp", 2, 1],
|
||||
["Home", 1, 0],
|
||||
|
||||
Reference in New Issue
Block a user