keplr-wallet icon indicating copy to clipboard operation
keplr-wallet copied to clipboard

Brave browser - no Keplr pop-up when expected

Open mhagel opened this issue 1 year ago • 4 comments

Describe the bug Extension does not pop up when trying to submit a transaction in Brave browser. Experienced in multiple dapps:

  • Osmosis, Wynd Dao, wallet.keplr.app
  • Sometimes can't connect, can't do any TX interactions if already connected

To Reproduce Steps to reproduce the behavior:

  1. Go to wallet.keplr.app
  2. Click on claim reward
  3. App indicates it is waiting for response from Keplr, but keplr does not appear
  4. (infinite spinner or disabled button, with no resolution)

Expected behavior Keplr 2.0 should work on Brave

Screenshots Screenshot 2023-06-16 at 11 19 05 AM Screenshot 2023-06-16 at 11 14 18 AM

Device details (please complete the following information):

  • OS: OSX
  • Browser: BRAVE - Version 1.52.126 Chromium: 114.0.5735.133 (Official Build) (arm64)
  • Keplr Version: 0.12.9

Additional context Add any other context about the problem here.

  • I tried deleting all connected websites and re-adding them. No change.
  • I tried Shields down and cleared cache. No change.
  • I tried restarting Brave and restarting my computer. No change.
  • I tried opening fresh tabs for the mentioned sites. No change.
  • Keplr on Brave was always fine before 2.0
  • My case may be unique because I manually updated Keplr to v0.12.9 instead of waiting for an update.

mhagel avatar Jun 16 '23 17:06 mhagel

Does it happen in a specific environment or under a specific condition? Does restarting the web browser fix it and does it occur again under certain circumstances/condition?

Thunnini avatar Jun 19 '23 05:06 Thunnini

Does it happen in a specific environment or under a specific condition?

I use a Macbook Pro. I have noticed that it works fine when only using my laptop screen. But the problem occurs when Brave is open in my secondary (HP) monitor.

Does restarting the web browser fix it and does it occur again under certain circumstances/condition?

No, no change when I restart browser

mhagel avatar Jul 12 '23 03:07 mhagel

I'm also having a lot of issues with Keplr since 2.0 upgrade.

My main problem is that Keplr simply will not connect to any dapps. I'll click on Connect wallet and then the Keplr icon and nothing happens, no pop-up.

Brobskie avatar Jul 29 '23 19:07 Brobskie

I encountered the same problem and discovered that it seems to be related to the positioning of the popup that is trying to open. Specifically, the problem occurs because the new popup tries to open in a position that is off-screen.

This problem can be replicated by using an external monitor that is set up in the operating system to be logically higher than the monitor to its right, while using a Chromium-based browser (such as Chrome or Brave) in full-screen mode.

In these circumstances, the top and left coordinates for the pop-up, which are calculated based on the dimensions of the current browser window, do not match the screen coordinates recognised by the operating system, resulting in the pop-up failing to display: Invalid value for bounds. Bounds must be at least 50% within the visible screen space.

You can see the error described in this screenshot: Screenshot 2024-03-07 alle 12 46 27

After a check to the problem, I found that the root cause lies in the code of the openPopupWindow function, which can be found here: https://github.com/chainapsis/keplr-wallet/blob/9faf2747d16db255280484e1e9fb159dfba1457a/packages/popup/src/index.ts#L19-L30

In this section of code, the top and left parameters for the popup are determined based on the current width of the window. The intention is to display the popup (not the main window of the keplr extension, but new popups, like those for adding a new chain) near the right side of the screen. However, this calculation produces values that are not on the screen, and the popup does not open, leading to the problem encountered. A simple solution would be to always open these new windows in the upper left corner of the screen (coordinates 0,0), as this should not affect the user experience too much.

I'm working at a small PR for this.

giorgionocera avatar Mar 07 '24 12:03 giorgionocera