Skip to content

Commit abc0e87

Browse files
authored
refactor: wait for animation completion using Animation API (#10510)
1 parent 2723aa6 commit abc0e87

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

packages/app-layout/src/vaadin-app-layout-mixin.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -393,22 +393,11 @@ export const AppLayoutMixin = (superclass) =>
393393
/**
394394
* Returns a promise that resolves when the drawer opening/closing CSS transition ends.
395395
*
396-
* The method relies on the `--vaadin-app-layout-transition-duration` CSS variable to detect whether
397-
* the drawer has a CSS transition that needs to be awaited. If the CSS variable equals `0s`,
398-
* the promise resolves immediately.
399-
*
400396
* @return {Promise}
401397
* @private
402398
*/
403399
__drawerTransitionComplete() {
404-
return new Promise((resolve) => {
405-
if (this._getCustomPropertyValue('--vaadin-app-layout-transition-duration') === '0s') {
406-
resolve();
407-
return;
408-
}
409-
410-
this.$.drawer.addEventListener('transitionend', resolve, { once: true });
411-
});
400+
return Promise.all(this.$.drawer.getAnimations().map((animation) => animation.finished));
412401
}
413402

414403
/** @private */

0 commit comments

Comments
 (0)