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 27, 2022
1 parent 16cd092 commit e65f524
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 e65f524

Please sign in to comment.