Skip to content

Commit

Permalink
fix(components): [dropdown] fix A11y when tooltip show (#8655)
Browse files Browse the repository at this point in the history
  • Loading branch information
shooterRao committed Jul 7, 2022
1 parent 468c3a3 commit 7f3000a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/components/dropdown/src/dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
teleported
pure
persistent
@before-show="handleShowTooltip"
@before-hide="handleHideTooltip"
@before-show="handleBeforeShowTooltip"
@show="handleShowTooltip"
@before-hide="handleBeforeHideTooltip"
>
<template #content>
<el-scrollbar
Expand Down Expand Up @@ -191,13 +192,17 @@ export default defineComponent({
}
}
function handleBeforeShowTooltip() {
emit('visible-change', true)
}
function handleShowTooltip(event?: Event) {
if (event?.type === 'keydown') {
contentRef.value.focus()
}
emit('visible-change', true)
}
function handleHideTooltip() {
function handleBeforeHideTooltip() {
emit('visible-change', false)
}
Expand Down Expand Up @@ -245,8 +250,9 @@ export default defineComponent({
handleEntryFocus,
handleClose,
handleOpen,
handleBeforeShowTooltip,
handleShowTooltip,
handleHideTooltip,
handleBeforeHideTooltip,
onFocusAfterTrapped,
popperRef,
contentRef,
Expand Down

0 comments on commit 7f3000a

Please sign in to comment.