Skip to content

Commit

Permalink
fix(RovingFocus): wrong focus on group instead of item
Browse files Browse the repository at this point in the history
  • Loading branch information
zernonia committed Sep 4, 2024
1 parent 0cf2c06 commit 8fe9168
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/radix-vue/src/RovingFocus/RovingFocusGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,16 @@ function handleFocus(event: FocusEvent) {
focusFirst(candidateItems, props.preventScrollOnEntryFocus)
}
}
isClickFocus.value = false
}
function handleMouseUp() {
// reset `isClickFocus` after 1 tick because handleFocus might not triggered due to focused element
setTimeout(() => {
isClickFocus.value = false
}, 1)
}
defineExpose({
getItems,
})
Expand Down Expand Up @@ -140,6 +146,7 @@ provideRovingFocusGroupContext({
:dir="dir"
style="outline: none"
@mousedown="isClickFocus = true"
@mouseup="handleMouseUp"
@focus="handleFocus"
@blur="isTabbingBackOut = false"
>
Expand Down

0 comments on commit 8fe9168

Please sign in to comment.