Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts the Reader Registration “sign into an existing account” flow so that when it’s initiated from within an overlay/modal context, the post-login “Continue” action doesn’t redirect away from the underlying page.
Changes:
- Detect whether the account-link trigger lives inside an overlay/modal container via
closest(...). - Skip configuring the redirect callback when inside an overlay, so “Continue” closes the modal instead of navigating away.
Comments suppressed due to low confidence (1)
src/reader-activation-auth/index.js:79
isInsideOverlaycurrently disables the redirect callback entirely. SinceopenAuthModal()usesonSuccessas a fallback when the reader is already authenticated or when the auth modal container is missing, this makes the click a no-op in overlay contexts (the handler still callspreventDefault()). Consider always setting a callback whenredirectis present, and inside that callback only skipping the redirect when it’s invoked from a successful auth flow (i.e., when it receives the(message, data)args fromauthCallback), while still redirecting on the no-args fallback path.
if ( redirect && redirect !== '#' && ! isInsideOverlay ) {
callback = () => {
window.location.href = redirect;
};
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


All Submissions:
Changes proposed in this Pull Request:
Login flow for existing users from Reader Registration block happens in a modal. And end of successful login, reader has the option to either hit the 'Continue' button or the 'X' to exit the flow. 'Continue' redirects to a signup page; 'X' closes the modal and leaves the user on the page they started the flow.
This PR detects whether the form is being shown in a modal; if so, it skips the redirect step so that 'Continue' will close the modal just like the 'X' button.
Note that the block may appear on a standalone page (like
/my-account/when not logged in). In those cases, the existing behavior--the redirect--is left unchanged so that the reader exits at a useful location.Addresses NPPM-2542: Bug: Reader Registration block redirects off the current page after using the Magic Link OTP.
How to test the changes in this Pull Request:
Original modal flow as documented in the Linear issue
fix/modal-skip-login-redirecttopic branch.Standalone page test
/my-account/.Other information: