CASH-79: add ability to stop page scroll on modal open/close
This commit is contained in:
parent
4bf51c09ea
commit
ba32c8e417
4 changed files with 6 additions and 4 deletions
|
|
@ -53,6 +53,7 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
headerText: String,
|
headerText: String,
|
||||||
footerButtonText: String,
|
footerButtonText: String,
|
||||||
|
suppressPageScroll: Boolean,
|
||||||
onModalOpenedCallback: {
|
onModalOpenedCallback: {
|
||||||
type: Function,
|
type: Function,
|
||||||
},
|
},
|
||||||
|
|
@ -107,8 +108,10 @@ export default {
|
||||||
onModalClosed() {
|
onModalClosed() {
|
||||||
this.resetButtonStyle();
|
this.resetButtonStyle();
|
||||||
this.onModalClosedCallback?.();
|
this.onModalClosedCallback?.();
|
||||||
|
if (this.suppressPageScroll) document.querySelector("body").classList.remove("prevent-modal-scroll");
|
||||||
},
|
},
|
||||||
openModal() {
|
openModal() {
|
||||||
|
if (this.suppressPageScroll) document.querySelector("body").classList.add("prevent-modal-scroll");
|
||||||
const modal = Modal.getOrCreateInstance(document.getElementById(this.modalId));
|
const modal = Modal.getOrCreateInstance(document.getElementById(this.modalId));
|
||||||
modal.show();
|
modal.show();
|
||||||
this.$emit("isModalOpened", true);
|
this.$emit("isModalOpened", true);
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,7 @@
|
||||||
@back-clicked="handleBackButtonAction"
|
@back-clicked="handleBackButtonAction"
|
||||||
@ForwardClicked="handleForwardButtonAction" />
|
@ForwardClicked="handleForwardButtonAction" />
|
||||||
|
|
||||||
<saveProgressModalQuestion
|
<saveProgressModalQuestion modalWidgetName="SaveProgressModalWidget" />
|
||||||
modalWidgetName="SaveProgressModalWidget" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
<modal
|
<modal
|
||||||
:ref="modalName"
|
:ref="modalName"
|
||||||
:headerText="modalHeaderText"
|
:headerText="modalHeaderText"
|
||||||
|
suppressPageScroll
|
||||||
:footerButtonText="modalButtonText"
|
:footerButtonText="modalButtonText"
|
||||||
@footer-button-event="saveProgress">
|
@footer-button-event="saveProgress">
|
||||||
<p class="modal-body">{{ modalBodyText }}</p>
|
<p class="modal-body">{{ modalBodyText }}</p>
|
||||||
|
|
@ -80,7 +81,6 @@ export default {
|
||||||
// TODO send store call to send to new API (that triggers an email send)
|
// TODO send store call to send to new API (that triggers an email send)
|
||||||
|
|
||||||
// TODO hide button trigger and replace with success message
|
// TODO hide button trigger and replace with success message
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ body {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.modal-open {
|
.modal-open:not(.prevent-modal-scroll) {
|
||||||
.container-fluid {
|
.container-fluid {
|
||||||
&.page-container-grouped-styles {
|
&.page-container-grouped-styles {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue