-
Notifications
You must be signed in to change notification settings - Fork 9
Fix browser popup blocking by adding popup-safe connection methods #225
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
Draft
Copilot
wants to merge
4
commits into
main
Choose a base branch
from
copilot/fix-224
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Deploying id-nuwa with
|
| Latest commit: |
b127660
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1908071e.id-nuwa.pages.dev |
| Branch Preview URL: | https://copilot-fix-224.id-nuwa.pages.dev |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Deploying nuwa-login-demo with
|
| Latest commit: |
1dc43a8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9b09da9a.nuwa-login-demo.pages.dev |
| Branch Preview URL: | https://copilot-fix-224.nuwa-login-demo.pages.dev |
Co-authored-by: jolestar <[email protected]>
Co-authored-by: jolestar <[email protected]>
Co-authored-by: jolestar <[email protected]>
Copilot
AI
changed the title
[WIP] Browser might prevent async calling `connect()
Fix browser popup blocking by adding popup-safe connection methods
Jul 7, 2025
Contributor
|
no need to expose the |
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.
Problem
The
connect()method inIdentityKitWebperforms an async operation before callingwindow.open(), which can cause browsers to block the popup due to broken user activation chain:Modern browsers require
window.open()to be called in direct response to user actions without intervening async operations.Solution
Added two new methods to
IdentityKitWebclass that separate URL building from window opening:buildConnectUrl(): Pre-builds the connection URL (can be called ahead of time)openConnectUrl(url): Opens the URL immediately (call in direct response to user action)Usage with React Hook
Usage with SDK Directly
Changes Made
Core SDK Methods:
buildConnectUrl()method toIdentityKitWebclassopenConnectUrl()method toIdentityKitWebclassReact Hook Integration:
IdentityKitHookinterface to include new methodsuseIdentityKithookDocumentation & Examples:
Testing:
Benefits
window.open()connect()method still worksDemo
The demo shows both the legacy approach (which may be blocked) and the new popup-safe approach working correctly.
Fixes #224.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.