- From: Emilio Cobos Álvarez via GitHub <sysbot+gh@w3.org>
- Date: Fri, 12 Jan 2024 00:13:38 +0000
- To: public-css-archive@w3.org
emilio has just created a new issue for https://github.com/w3c/csswg-drafts: == [cssom-view] Consider adding a programmatic way of resetting the visual viewport scale. == I just came across https://bugzilla.mozilla.org/show_bug.cgi?id=1873934, which seems like a Firefox bug, but contains an interesting code snippet. Simplified below would be: ``` function resetZoom() { document.head.querySelector("meta[name=viewport]") .setAttribute("content", "width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=yes") } ``` As hacky as it looks, the use case seems reasonable to me: > This is a map application. As such, pinching out the main screen will zoom in the map. However, when selecting a pin, the popup appears and will open full screen. Pinching out there will zoom in the text field - so far so good. > > However, when closing the popup, we want to reset the user scaling to 1.0. Otherwise, some of the controls might be out of view and might not be reachable, as panning will pan the map, not the view. Given you can pretty much achieve any scaling with the "change the meta viewport dynamically", it might be worth making the `VisualViewport.scale` property writable by authors? Or if not, at least provide a way of resetting it programmatically? thoughts? @bokand @theres-waldo @hiikezoe @smfr Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9787 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 00:13:39 UTC