Skip to content

Commit

Permalink
Restrict changes done for MWPW-136057 to commerce modal (#1285)
Browse files Browse the repository at this point in the history
* fix for MWPW-136656

* Update modal.js

* fix lint issue

* update css class name

* Update css class name
  • Loading branch information
Ruchika4 authored Sep 19, 2023
1 parent 7ab136d commit ee47db4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libs/blocks/modal/modal.css
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
column-count: 1;
}

.modal-open {
.commerce-modal-open {
overflow: hidden;
}

Expand Down
4 changes: 2 additions & 2 deletions libs/blocks/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function sendAnalytics(event) {
function closeModal(modal) {
const { id } = modal;
const closeEvent = new Event('milo:modal:closed');
document.body.classList.remove('modal-open');
document.body.classList.remove('commerce-modal-open');
window.dispatchEvent(closeEvent);
const localeModal = id?.includes('locale-modal') ? 'localeModal' : 'milo';
const analyticsEventName = window.location.hash ? window.location.hash.replace('#', '') : localeModal;
Expand Down Expand Up @@ -108,7 +108,6 @@ export async function sendViewportDimensionsOnRequest(messageInfo) {

export async function getModal(details, custom) {
if (!(details?.path || custom)) return null;
document.body.classList.add('modal-open');
const { id } = details || custom;

const dialog = createTag('div', { class: 'dialog-modal', id });
Expand Down Expand Up @@ -175,6 +174,7 @@ export async function getModal(details, custom) {
.forEach((element) => element.setAttribute('aria-disabled', 'true'));
}
if (dialog.classList.contains('commerce-frame')) {
document.body.classList.add('commerce-modal-open');
if (isInitialPageLoad) {
window.addEventListener('message', (messageInfo) => {
sendViewportDimensionsOnRequest(messageInfo);
Expand Down

0 comments on commit ee47db4

Please sign in to comment.