Skip to content

Commit

Permalink
fix: Ensure `_onModalAnimationEnd is called
Browse files Browse the repository at this point in the history
  • Loading branch information
pichfl committed May 31, 2022
1 parent 836be89 commit 38fa34d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions addon/components/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -98,6 +101,8 @@ export default Component.extend({
},

closeModal(result) {
this.modals._onModalAnimationStart();

// Trigger out animation
set(this, 'animatingOutClass', this.outAnimationClass);

Expand Down

0 comments on commit 38fa34d

Please sign in to comment.