polkadot-js / extension

Simple browser extension for managing Polkadot and Substrate network accounts in a browser. Allows the signing of extrinsics using these accounts. Also provides a simple interface for compliant extensions for dapps.
Apache License 2.0
972 stars 417 forks source link

Resize popup for consistent size on Windows and Mac OS #1242

Open F-OBrien opened 1 year ago

F-OBrien commented 1 year ago

Due to the differences in the way that Windows and Mac OS renders the window frames and borders it results in inconsistent popup sizes which obscures some information. e.g. the "Ask again later" option as shown below for Windows. This only happens when a popup is created and not when clicking on the extension icon. chrome.windows.create doesn't have a clean way to handle both OS's. This PR is a hacky way to try to handle both OS's.

Original chrome.windows.create outer dimensions = 560x621 (from POPUP_WINDOW_OPTS) Resulting Windows popup inner dimension = 544x582 image

After resize to 560x600 inner dimension image

Tbaut commented 1 year ago

I tested it on Firefox Linux and the hack doesn't seem to work. For instance, here's QR code request: image

jacogr commented 1 year ago

... These window sizes between browsers and platforms has been a huge PITA since the start...

Tbaut commented 1 year ago

Indeed, I've hit a wall many times trying to fix these. Even a somewhat hacky solution may be better than the current state. Thanks for looking into it @F-OBrien

F-OBrien commented 1 year ago

That's disappointing. Well it seems to work with Chrome at least if you wanted to consider it as a slight improvement over the current implementation.

jacogr commented 1 year ago

I'll defer to @Tbaut on this one since (like he mentioned above), he spent a lot of time on this in the past.

My general feeling is that - if it is better in some cases and no worse in others (e.g. FF), it is certainly worth a merge.

TL;DR As long as it doesn't make anything worse, I'm ok with it.