Skip to content

Commit

Permalink
fix(menu-option): fix keyboard trigger conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
haoziqaq committed Dec 29, 2024
1 parent f68f840 commit a95811f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions packages/varlet-ui/src/menu-option/MenuOption.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,25 @@ export default defineComponent({
return
}
if (event.key === ' ' || event.key === 'Enter') {
preventDefault(event)
}
if (event.key === 'Enter') {
root.value!.click()
}
if (event.key === 'ArrowRight') {
call(props.onKeyArrowX, event.key)
}
if (event.key === 'ArrowLeft') {
call(props.onKeyArrowX, event.key)
}
if (!isFocusing.value) {
return
}
if (event.key === ' ' || event.key === 'Enter') {
preventDefault(event)
}
if (event.key === 'Enter') {
root.value!.click()
}
}
function handleKeyup(event: KeyboardEvent) {
Expand All @@ -173,6 +177,7 @@ export default defineComponent({
async function handleSelect() {
await nextTick()
console.log(menuOptionProvider)
onSelect(menuOptionProvider)
}
Expand Down

0 comments on commit a95811f

Please sign in to comment.