fix(components): [tooltip] change ariaHidden value after closed the dropdown (#18207)

* fix(components): [tooltip] change ariaHidden value after closed dropdown

closed #17720

* test: fix test
This commit is contained in:
qiang 2024-09-10 15:58:53 +08:00 committed by GitHub
parent c4f7e27bdd
commit 7017d19260
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 6 deletions

View File

@ -1296,6 +1296,7 @@ describe('DatePicker keyboard events', () => {
await input.trigger('keydown', {
code: EVENT_CODE.enter,
})
await rAF()
const popperEl2 = document.querySelectorAll('.el-picker__popper')[0]
const attr2 = popperEl2.getAttribute('aria-hidden')
expect(attr2).toEqual('true')
@ -1321,6 +1322,7 @@ describe('DatePicker keyboard events', () => {
await input.trigger('keydown', {
code: EVENT_CODE.numpadEnter,
})
await rAF()
const popperEl2 = document.querySelectorAll('.el-picker__popper')[0]
const attr2 = popperEl2.getAttribute('aria-hidden')
expect(attr2).toEqual('true')

View File

@ -363,8 +363,6 @@ describe('TimePicker', () => {
})
it('ref handleClose', async () => {
vi.useFakeTimers()
const value = ref(new Date(2016, 9, 10, 18, 40))
const wrapper = mount(() => <TimePicker v-model={value.value} />)
const timePickerExposed = wrapper.findComponent(TimePicker).vm.$.exposed
@ -374,12 +372,10 @@ describe('TimePicker', () => {
await nextTick()
timePickerExposed.handleClose()
await nextTick()
await rAF()
const popperEl = document.querySelector('.el-picker__popper')
const attr = popperEl.getAttribute('aria-hidden')
expect(attr).toEqual('true')
vi.useRealTimers()
})
it('model value should sync when disabled-hours was updated', async () => {

View File

@ -106,10 +106,11 @@ const appendTo = computed(() => {
const contentStyle = computed(() => (props.style ?? {}) as any)
const ariaHidden = computed(() => !unref(open))
const ariaHidden = ref(true)
const onTransitionLeave = () => {
onHide()
ariaHidden.value = true
}
const stopWhenControlled = () => {
@ -164,6 +165,8 @@ watch(
(val) => {
if (!val) {
stopHandle?.()
} else {
ariaHidden.value = false
}
},
{