Ask HN: Why do certain websites' images get smaller when I zoom in?
It seems as though very frequently these days whenever I try to enlarge an image by zooming in within chrome (ctrl-+) images end up getting smaller. What is with this current anti-pattern? I see it all over the place including Whatsapp, google images, facebook's gallery view.
When I zoom in within my browser I would assume images would get bigger not smaller.
I believe this to be an issue within dynamic flex-based layouts and/or percentage based width on an image.
33 comments
[ 5.8 ms ] story [ 66.0 ms ] thread[0] https://www.w3schools.com/csSref/tryit.asp?filename=trycss_p...
Many images are responsive and will take up whatever (typically horizontal) space is available. So by making the text larger, there's less space left for the images and they become smaller.
I don't think that makes it an anti-pattern. It's more of a quirk of how zooming is implemented in browsers.(or perhaps the feature's name is misleading).
related, Firefox Android has: Settings -> Accessibility -> [allow] Zoom on all web sites
https://developer.mozilla.org/en-US/docs/Web/API/Window/devi...
Modern zoom on browsers is simply that: multiply everything by 1.1, 1.25 or whatever. This has been the case for probably a decade.
Ctrl +/- does not zoom, it changes the fontsize and devicePixelRatio.
Using a base size (the font size) and scaling everything relative to that using em solves many problems. Sites handle this differently and it is getting progressively worse, confusing screen readers.
https://www.quirksmode.org/blog/archives/2010/04/a_pixel_is_...
https://fronteers.nl/congres/2012/sessions/a-pixel-is-not-a-...
https://developer.mozilla.org/en-US/docs/Web/API/Window/devi...
as part of goog's strategy of deeply nested divs ftw in modern gmail
`document.querySelector('div[role="img"] img')` to look at it
from what I can see, the width & height in the parent div's style are changing manually every time I zoom, i.e. JS event. This is probably why it takes a second to update; css would be synchronous with the rest of the UX zooming, unless there's an animation
yuck. also impossible to right click, so no easy way to view the image in another tab
[0] https://javascript.plainenglish.io/an-easy-way-of-accessing-...
Also, as a caveat, this only works when `window.$` and `window.$$` have not been defined by the site's JS code.
https://imgur.com/a/DuIroyH
Uncheck that in FF find it in chrome...
EDIT: Cant find same in chrome settings - but I no longer use chrome... but this setting in FF, if checked, is annoying AF.
Then I got higher-resolution 4k screens, which simultaneously meant that scaling looked better, and that scaling images (not just text) was necessary. (I also now use `devPixelsPerPx=-1` to scale everything up by default to an appropriate DPI for the display.)
How do?
Does anybody knows if there's an extension or something for that?
Linux has support for touchpad pinch zoom, at least under Wayland. Not sure if it's still gated behind an about:config user pref or not.
If you don't have a touchpad, I'm pretty sure you can bind "pinch zoom" to <modifier key>+<mousewheel>. I think the about:config preference is `mousewheel.with_alt.action=5` (or `with_shift`, etc).
As for "pinch zoom" using the keyboard, I'm not sure. I don't believe there's any extension API for it. A check of the Mozilla bug tracker didn't bring up anything.