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

The CSS Working Group just discussed `[cssom-view] Consider adding a programmatic way of resetting the visual viewport scale.`, and agreed to the following:

* `RESOLVED: Add VisualViewport.prototype.resetScale()`

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> emilio: There's a use-case someone came up with, you have a form, the browser will zoom into that form element as needed for mobile<br>
&lt;fantasai> emilio: that's a modal dialog, and after they're done, the browser ends up in a zoom state<br>
&lt;fantasai> emilio: but if they're in a map that has pinch gestures etc, they hvae to reset the browser zoom to see the whole map<br>
&lt;fantasai> emilio: they do this by calling querySelector to get the meta viewport and then changing its content value to be like initial-scale=1/minimum-scale=1/max-scale=1<br>
&lt;fantasai> emilio: someone filed a bug that it wasn't synchronous in Firefox<br>
&lt;TabAtkins> q+<br>
&lt;fantasai> emilio: it seems there's some concern about providing a setter to viewport scale, but maybe a function that resets the scale to 1 would be a good idea?<br>
&lt;fantasai> emilio: use case seems reasonable<br>
&lt;fantasai> emilio: main concern from smfr and David Bokand &amp;co was making it very easy to misuse, to misbehave<br>
&lt;fantasai> emilio: but if we just provide a resetScale() method that seems reasonable?<br>
&lt;dbaron> s/Bokand/Bokan/<br>
&lt;Rossen_> ack TabAtkins<br>
&lt;fantasai> TabAtkins: Given you can do this already in mobile, and it's bad when setting min-scale/max-scale which doesn't let me zoom at all<br>
&lt;fantasai> TabAtkins: I think this is reasonable<br>
&lt;fantasai> TabAtkins: ok if it's somewhat async<br>
&lt;fantasai> TabAtkins: Being able to hard-set it, you can already do it with meta-viewport<br>
&lt;fantasai> TabAtkins: I lean towards doing reset to initial<br>
&lt;fantasai> TabAtkins: that has a clear use case, seems OK<br>
&lt;bramus> +1<br>
&lt;fantasai> dholbert: question about whether this affects desktop<br>
&lt;fantasai> emilio: I would lean towards yes for consistency, but if browsers misbehave we could limit it to mobile<br>
&lt;TabAtkins> (Important to note: I hate it when sites prevent me from zooming. But they can already do it, so eh, and the "reset to initial" has a reasonable use-case.)<br>
&lt;fantasai> TabAtkins: I wouldn't mind if the browser detected multiple resets and popped up a dialog asking if you want the page to be allowed to continue doing so<br>
&lt;fantasai> TabAtkins: but that's quality of implementation<br>
&lt;fantasai> emilio: would rest to your meta-viewport settings<br>
&lt;fantasai> s/rest/reset/<br>
&lt;emilio> PROPOSED: Add VisualViewport.prototype.resetScale()<br>
&lt;fantasai> fantasai: Are you sure it's not resetZoom()? :)<br>
&lt;fantasai> emilio: no the ?? property is scale<br>
&lt;fantasai> RESOLVED: Add VisualViewport.prototype.resetScale()<br>
&lt;fantasai> &lt;br duration=17min><br>
</details>


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


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

Received on Tuesday, 13 February 2024 23:51:48 UTC