fix incorrect activeIndex when handling Focus.Previous

This is already available in the React version, now let's sync it in the
Vue version as well.
This commit is contained in:
Robin Malfait
2024-01-06 01:51:07 +01:00
parent a3276570d2
commit bc4a744947
@@ -48,6 +48,9 @@ export function calculateActiveIndex<TItem>(
}
case Focus.Previous: {
// If nothing is active, focus the last relevant item
if (activeIndex === -1) activeIndex = items.length
for (let i = activeIndex - 1; i >= 0; --i) {
if (!resolvers.resolveDisabled(items[i], i, items)) {
return i