修复(充值弹层): 未选中时左方向键回卷到最后一项

- resolveRovingIndex 的 currentIndex 允许为 -1,ArrowLeft 特判为 length-1,避免落到倒数第二项
This commit is contained in:
2026-10-05 11:59:32 +08:00
parent 5d2de88a40
commit f0dfddb910
@@ -54,7 +54,10 @@ function resolveRovingIndex(
case 'End':
return length - 1;
case 'ArrowLeft':
return (currentIndex - 1 + length) % length;
// 未选中(-1)时应回卷到最后一项,而不是 (length - 2) % length。
return currentIndex < 0
? length - 1
: (currentIndex - 1 + length) % length;
case 'ArrowRight':
return (currentIndex + 1) % length;
default: