-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Bug] Metamask closes another Chrome extension popup after calling eth.requestAccounts #15789
Comments
Thank you for your report @sunxivincent. I could reproduce the issue and we are now investigating it. test-extension-mm-connection.webm |
@seaona One thing I have noticed is that if I open the chrome debugger view, the feature works as expected. I am suspecting it is related to failing to control the correct view open/close. |
It seems this might be a platform behavior that we don't control.
|
I am creating a workaround for this and hopefully it will benefit future people that has similar issue. The workaround is basically creating a pseudo window when invoking Metamask in your own chrome extension popup. And always focus this window (you may add some UI to remind user not to close it when applying your business logic) I am pasting my code in below. My future thought would be in Metamask side it exposes an option that allows its client to control whether or not closing up the Metamask after it finishes signing, rather than it closing the window for all the cases (which will end up closing up the caller extension popup as well). But I am leaving this suggestion to the community.
|
Describe the bug
I am building a chrome extension using react and calling Metamask for fetching user's account. I am using
metamask-extension-provider
instead ofwindow.ethereum
as suggested so I can communicate with the chain using Metamask.Below sample code shows a button click event handler and I am expecting after signing with Metamask, user can go back to extension popup's main page showing they have been connected.
however the Metamask closed both itself and my chrome extension popup. After diving into the metamask code a little bit, I am suspicious there are perhaps window management logic controlling popup's on and off which fails to consider such scenario?
https://github.com/MetaMask/metamask-storybook/blob/master/scripts/background.js#L489
Steps to reproduce
metamask-extension-provider
torequestAccounts
Error messages or log output
No response
Version
10.18.4
Build type
No response
Browser
Chrome
Operating system
MacOS
Hardware wallet
No response
Additional context
MetaMask/extension-provider#26 this issue may be relevant
The text was updated successfully, but these errors were encountered: