Skip to content

Commit

Permalink
fix: disable body scroll when auth modal is open (#3134)
Browse files Browse the repository at this point in the history
This PR disables scrolling from main body while the auth modal is open.
  • Loading branch information
chickenn00dle authored May 29, 2024
1 parent 3b356fe commit 7d12f68
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions assets/reader-activation-auth/auth-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export function openAuthModal( config = {} ) {
container.config = {};
modal.setAttribute( 'data-state', 'closed' );
document.body.classList.remove( 'newspack-signin' );
document.body.style.overflow = 'auto';
if ( modal.overlayId && window.newspackReaderActivation?.overlays ) {
window.newspackReaderActivation.overlays.remove( modal.overlayId );
}
Expand Down Expand Up @@ -123,6 +124,7 @@ export function openAuthModal( config = {} ) {
container.setFormAction( initialFormAction, true );

document.body.classList.add( 'newspack-signin' );
document.body.style.overflow = 'hidden';
modal.setAttribute( 'data-state', 'open' );
if ( window.newspackReaderActivation?.overlays ) {
modal.overlayId = window.newspackReaderActivation.overlays.add();
Expand Down

0 comments on commit 7d12f68

Please sign in to comment.