diff --git a/js/components/forms/multi_step_modal_form.js b/js/components/forms/multi_step_modal_form.js index f0742336..3ef31b81 100644 --- a/js/components/forms/multi_step_modal_form.js +++ b/js/components/forms/multi_step_modal_form.js @@ -9,7 +9,7 @@ import toggler from '../toggler' export default { name: 'multi-step-modal-form', - mixins: [FormMixin, Modal], + mixins: [FormMixin], components: { toggler, @@ -38,7 +38,7 @@ export default { mounted: function() { this.$root.$on('field-change', this.handleValidChange) - this.$on('modalOpen', this.handleModalOpen) + this.$root.$on('modalOpen', this.handleModalOpen) }, methods: { diff --git a/js/mixins/modal.js b/js/mixins/modal.js index b865097d..1a2fec6c 100644 --- a/js/mixins/modal.js +++ b/js/mixins/modal.js @@ -17,8 +17,21 @@ export default { filter: idSelector, }) }, + + // TODO: activeModal should be tracked on the root + handleModalOpen: function(event) { + if (!event.isOpen) { + this.activeModal = null + } + }, }, + + mounted: function() { + this.$root.$on('modalOpen', this.handleModalOpen) + }, + data: function() { + // TODO: only the root component should know about the activeModal return { activeModal: null, allyHandler: null, diff --git a/templates/components/modal.html b/templates/components/modal.html index c7b582ff..cb9426c1 100644 --- a/templates/components/modal.html +++ b/templates/components/modal.html @@ -1,7 +1,7 @@ {% from "components/icon.html" import Icon %} {% macro Modal(name, dismissable=False, classes="") -%} -