Skip to content

Commit 8c997ce

Browse files
committed
fix(NcPopover): properly wait for css animation completion
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
1 parent a8bdd3c commit 8c997ce

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/components/NcPopover/NcPopover.vue

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ import NcPopoverTriggerProvider from './NcPopoverTriggerProvider.vue'
174174
* @typedef {import('focus-trap').FocusTargetValueOrFalse} FocusTargetValueOrFalse
175175
* @typedef {FocusTargetValueOrFalse|() => FocusTargetValueOrFalse} SetReturnFocus
176176
*/
177-
178177
export default {
179178
name: 'NcPopover',
180179
@@ -239,6 +238,7 @@ export default {
239238
data() {
240239
return {
241240
internalShown: this.shown,
241+
animationDuration: 100,
242242
}
243243
},
244244
@@ -254,6 +254,7 @@ export default {
254254
255255
mounted() {
256256
this.checkTriggerA11y()
257+
this.animationDuration = parseInt(getComputedStyle(this.$el).getPropertyValue('--animation-quick')) || 100
257258
},
258259
259260
beforeDestroy() {
@@ -385,22 +386,27 @@ export default {
385386
await this.useFocusTrap()
386387
this.addEscapeStopPropagation()
387388
389+
setTimeout(() => {
388390
/**
389391
* Triggered after the tooltip was visually displayed.
390392
*
391393
* This is different from the 'show' and 'apply-show' which
392394
* run earlier than this where there is no guarantee that the
393395
* tooltip is already visible and in the DOM.
394396
*/
395-
this.$emit('after-show')
397+
this.$emit('after-show')
398+
}, this.animationDuration)
396399
},
397-
afterHide() {
400+
async afterHide() {
398401
this.clearFocusTrap()
399402
this.clearEscapeStopPropagation()
400-
/**
401-
* Triggered after the tooltip was visually hidden.
402-
*/
403-
this.$emit('after-hide')
403+
404+
setTimeout(() => {
405+
/**
406+
* Triggered after the tooltip was visually hidden.
407+
*/
408+
this.$emit('after-hide')
409+
}, this.animationDuration)
404410
},
405411
},
406412
}

0 commit comments

Comments
 (0)