Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product Gallery block: Prevent page from scrolling when pop-up is open #43378

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions plugins/woocommerce-blocks/assets/css/style.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
body.wc-block-product-gallery-modal-open {
overflow: hidden;
}

// These styles are for the server side rendered product grid blocks.
.wc-block-grid__products .wc-block-grid__product-image {
text-decoration: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const closeDialog = ( context: ProductGalleryContext ) => {
context.isDialogOpen = false;
// Reset the main image.
context.selectedImage = context.firstMainImageId;
document.body.classList.remove( 'wc-block-product-gallery-modal-open' );
};

const productGallery = {
Expand All @@ -60,6 +61,9 @@ const productGallery = {
openDialog: () => {
const context = getContext();
context.isDialogOpen = true;
document.body.classList.add(
'wc-block-product-gallery-modal-open'
);
},
selectImage: () => {
const context = getContext();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix
Comment: Prevent page scrolling when the Product Gallery Pop-Up is open.