Re: [csswg-drafts] [cssom-view] Consider adding a programmatic way of resetting the visual viewport scale. (#9787)

My recollection from past discussions about the visual viewport is that it was intended to be an "inert" feature, i.e. a way for a user to control their view of the page with no or minimal effect on the content being viewed.

The Visual Viewport API has eroded that a bit, since sites can now react to visual viewport movements, but allowing sites to set the pinch-zoom scale could open the door to new user-hostile behaviours, such as trying to prevent the user from zooming in at all, or from viewing a certain part of the page zoomed in, etc.

That said, on Android at least, we have an accessibility setting called "Zoom on all websites" which overrides current ways for a page to disable pinch-zooming (such as `user-scalable=no`). Perhaps allowing the page to modify the scale could be fine as long as this override behaviour applied to that as well?

---

Regarding the use case discussed in the bug and the StackOverflow question, I wonder if it points to something else we could be doing better: giving the page a more explicit way to say "the page is now handling zooming, the browser shouldn't handle it". This came up in [bug 1866028](https://bugzilla.mozilla.org/show_bug.cgi?id=1866028), where such a mechanism would avoid situations where users accidentally trigger browser pinch-zoom on pages that intended to handle the gesture themselves, leading to e.g. controls being stuck offscreen (outside of the visual viewport).

If we had such an API, we could then e.g. say that whenever the page is handling zooming, the browser's zoom level should be 1, thereby getting this "reset" behaviour automatically.

-- 
GitHub Notification of comment by theres-waldo
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9787#issuecomment-1890094825 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 12 January 2024 23:01:07 UTC