zluca / Sidebar

WebExtension that imprement Sidebar into browser.
GNU General Public License v3.0
31 stars 9 forks source link

Change font size setting to a dropdown (medium, large etc.). #33

Closed Su-Well closed 5 years ago

Su-Well commented 5 years ago

Font size now scales perfectly both on my 1440p and 4k monitor

Su-Well commented 5 years ago

Looking into this more, I'm realizing that window.devicePixelRatio was the real source of the font size issues, and not the use of px for setting font size. The problem is that window.devicePixelRatio is determined not only by browser zoom - it is also determined by the OS zoom level. So with browser zoom 100% it gives 1.25 on my 1440p monitor, and 2.0 on my 4k monitor.

In addition to the fact that this is problematic for users with monitors with different resolutions, it is also flawed for all users with a high resolution monitor (1440p or more). The reason for this is that dividing by this value will in all cases revert the OS zoom level (in addition to the browser zoom level), making the text tiny on high resolution monitors.

Unfortunately, it looks like there aren't any better options available either for detecting zoom levels. There are a few hacks that may work for some browser vendors/version for some users, but no vendors expose an API method for detecting this.

Since I work on a 1440p and a 4k monitor, adding this back would make the extension unusable for me. Moreover, I think generally that making the normal font size correct is more important than adjusting for browser zoom events. Therefore, I've come to the conclusion that I prefer the current solution in this PR, and I will not be moving forward with the requested changes.

I will leave it up to you to decide which of these considerations you want to prioritize, and I fully understand if you reject the PR as a result.

zluca commented 5 years ago

The problem is that window.devicePixelRatio is determined not only by browser zoom - it is also determined by the OS zoom level

Can't confirm it experimentally, maybe OS specific? Are you using Windows?

Moreover, I think generally that making the normal font size correct is more important than adjusting for browser zoom events.

I have tabs with zoom from 100% to 160%. And when Sidebar has different size in different tabs it looks terrible.

Ok. This is more complicated than I thinked before. So I need time for some experiments and reflections.

Su-Well commented 5 years ago

yes, I'm using windows

zluca commented 5 years ago

PR closed. Some code copypasted directly because its easier. =)