From 83185d40549d134d522c7bfc264cbd2c22cf0b8a Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Mon, 2 Feb 2026 18:53:01 -0700 Subject: [PATCH 1/3] fix: skip redirect from login modal --- src/reader-activation-auth/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/reader-activation-auth/index.js b/src/reader-activation-auth/index.js index 9a159f3584..529c2bac3c 100644 --- a/src/reader-activation-auth/index.js +++ b/src/reader-activation-auth/index.js @@ -47,6 +47,14 @@ window.newspackRAS.push( readerActivation => { ev.preventDefault(); const modalTrigger = ev.target; let callback, redirect; + + // If reader sees this form as a modal, it's likely they'll want + // to dismiss the modal and stay on the underlying page when + // sign-in flow is complete. + // Detect a modal container in ancestors and flag so we can skip + // the redirect later. + const isInsideOverlay = modalTrigger.closest( '.newspack-popup, .newspack-lightbox, [class*="lightbox"], [class*="popup"]' ); + if ( ev.target.getAttribute( 'data-redirect' ) ) { redirect = ev.target.getAttribute( 'data-redirect' ); } else { @@ -62,7 +70,9 @@ window.newspackRAS.push( readerActivation => { } } } - if ( redirect && redirect !== '#' ) { + + // If we're in a modal, ignore redirect so 'Continue' dismisses it and reader can continue on the current page. + if ( redirect && redirect !== '#' && ! isInsideOverlay ) { callback = () => { window.location.href = redirect; }; From b8b3bf0adb82615a5e57e491095721bed7ed3f86 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Mon, 2 Feb 2026 21:49:20 -0700 Subject: [PATCH 2/3] fix: implement Copilot suggestion Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/reader-activation-auth/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/reader-activation-auth/index.js b/src/reader-activation-auth/index.js index 529c2bac3c..d6d566ab9f 100644 --- a/src/reader-activation-auth/index.js +++ b/src/reader-activation-auth/index.js @@ -53,7 +53,9 @@ window.newspackRAS.push( readerActivation => { // sign-in flow is complete. // Detect a modal container in ancestors and flag so we can skip // the redirect later. - const isInsideOverlay = modalTrigger.closest( '.newspack-popup, .newspack-lightbox, [class*="lightbox"], [class*="popup"]' ); + const isInsideOverlay = Boolean( + modalTrigger.closest( '.newspack-popup, .newspack-lightbox, [class*="lightbox"], [class*="popup"]' ) + ); if ( ev.target.getAttribute( 'data-redirect' ) ) { redirect = ev.target.getAttribute( 'data-redirect' ); From 0da455fae007de65eda8cfc3c900246ec691bda0 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Mon, 2 Feb 2026 23:32:21 -0700 Subject: [PATCH 3/3] fix: check that works on an on-page block --- src/reader-activation-auth/index.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/reader-activation-auth/index.js b/src/reader-activation-auth/index.js index d6d566ab9f..831ba8e3e7 100644 --- a/src/reader-activation-auth/index.js +++ b/src/reader-activation-auth/index.js @@ -48,14 +48,8 @@ window.newspackRAS.push( readerActivation => { const modalTrigger = ev.target; let callback, redirect; - // If reader sees this form as a modal, it's likely they'll want - // to dismiss the modal and stay on the underlying page when - // sign-in flow is complete. - // Detect a modal container in ancestors and flag so we can skip - // the redirect later. - const isInsideOverlay = Boolean( - modalTrigger.closest( '.newspack-popup, .newspack-lightbox, [class*="lightbox"], [class*="popup"]' ) - ); + // Check ancestors to see if we're signing in to an existing account. + const isExistingAccountFlow = Boolean( modalTrigger.closest( '.newspack-registration__have-account' ) ); if ( ev.target.getAttribute( 'data-redirect' ) ) { redirect = ev.target.getAttribute( 'data-redirect' ); @@ -74,7 +68,7 @@ window.newspackRAS.push( readerActivation => { } // If we're in a modal, ignore redirect so 'Continue' dismisses it and reader can continue on the current page. - if ( redirect && redirect !== '#' && ! isInsideOverlay ) { + if ( redirect && redirect !== '#' && ! isExistingAccountFlow ) { callback = () => { window.location.href = redirect; };