Skip to content

Commit

Permalink
fix: ensure no previous transitionend event triggers after-modal-hidd…
Browse files Browse the repository at this point in the history
…en (#1081)
  • Loading branch information
Timon Lukas authored Dec 9, 2020
1 parent 8eaef33 commit 0c5ffe2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/core/src/components/cv-modal/cv-modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,17 @@ export default {
document.body.classList.remove(`${this.carbonPrefix}--body--with-modal-open`);
if (this.dataVisible) {
this.$el.addEventListener('transitionend', this.afterHide, { once: true });
this.$el.addEventListener('transitionend', this.afterHide);
}
this.dataVisible = false;
this.$emit('modal-hidden');
},
afterHide() {
this.$emit('after-modal-hidden');
afterHide(event) {
if (event.propertyName === 'opacity') {
this.$emit('after-modal-hidden');
this.$el.removeEventListener('transitionend', this.afterHide);
}
},
onPrimaryClick(ev) {
this.$emit('primary-click');
Expand Down

0 comments on commit 0c5ffe2

Please sign in to comment.