From 38fa34dd2a83b86b35b124793e5ac12ac2425445 Mon Sep 17 00:00:00 2001 From: Florian Pichler Date: Fri, 27 May 2022 20:58:02 +0200 Subject: [PATCH] fix: Ensure `_onModalAnimationEnd is called --- addon/components/modal.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/addon/components/modal.js b/addon/components/modal.js index 6c08d9ac..5fc92242 100644 --- a/addon/components/modal.js +++ b/addon/components/modal.js @@ -64,14 +64,17 @@ export default Component.extend({ this.fadeOutEnd = ({ target, animationName }) => { cancel(this._timeout); - let isntTarget = target !== element; - let animationEndsWrong = animationName.substring(animationName.length - 4) !== '-out'; - - if (isntTarget || animationEndsWrong) { + if (target !== element) { return; } - this.removeModal(); + this.modals._onModalAnimationEnd(); + + let isOutAninmation = animationName.substring(animationName.length - 4) === '-out'; + + if (isOutAninmation) { + this.removeModal(); + } }; this.modals._onModalAnimationStart(); @@ -98,6 +101,8 @@ export default Component.extend({ }, closeModal(result) { + this.modals._onModalAnimationStart(); + // Trigger out animation set(this, 'animatingOutClass', this.outAnimationClass);