-
Notifications
You must be signed in to change notification settings - Fork 714
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
[feature] prevent web wallets from getting blocked by browsers as unwarranted pop-up #4610
Comments
Hello @pedrouid , let me share my investigation on these popup blocking issues in Safari. Our setup is next.js + wagmi. 1. Connecting to a web wallet from the "All Wallets" listAfter selecting a wallet you'll see a loading UI with the "Open" button, but clicking this button will always block the popup window. Screen.Recording.2024-06-12.at.17.56.19.movIn short, I see two issues here:
Maybe this button doesn't need the Here are some references to the code I looked at:
2. Connecting to an injected walletAfter selecting a wallet it will try to connect automatically but will fail because the popup window will be blocked. Screen.Recording.2024-06-12.at.17.58.30.movHere I believe the issue is with auto connect. Since it was not initiated by the user, it is not recognized as a trusted event (same as the 2nd issue of the 1st case) https://github.com/WalletConnect/web3modal/blob/d3490f93f0ee931c52caaaeed0354e3581fded00/packages/scaffold/src/views/w3m-connecting-external-view/index.ts#L31 Maybe a possible fix could be: if there is an error thrown and it's not an RpcError, don't show the error message and show the "Open" button instead of the "Try again" button. -- If you need more details or clarification please let me know. |
What problem does this new feature solve?
Unless the window opened is a 'direct result' of a user interaction (like button click), browsers block it as pop-ups. Safari has the most stringent requirements. Currently our testing with web wallets on walletconnect has the following behavior:
Desktop:
Mobile:
Describe the solution you'd like
Our testing shows that if the window open is called with less than 1s delay from the click event and not within an asynchronous callback, the browser allows the window to open. We propose showing an "open" button on the "web link" tab of the wallet in the web3modal which opens the window directly. Don't have any network requests and asynchronous callbacks in between.
cc @pedrouid
The text was updated successfully, but these errors were encountered: