[csswg-drafts] [cssom-view] should screen.width and screen.height reflect orientation? (#5204)

foolip has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom-view] should screen.width and screen.height reflect orientation? ==
[The `Screen` Interface](https://drafts.csswg.org/cssom-view/#the-screen-interface) define `screen.width` and `screen.height` in terms of the [Web-exposed screen area](https://drafts.csswg.org/cssom-view/#web-exposed-screen-area).

It looks like this has not changed in a long time, since https://github.com/w3c/csswg-drafts/commit/dc36ecd7a46b173f958dafa736a84eb9753afb7b.

A web developer reported having to work around something around screen width/height in combination with orientation, and it looks like implementations disagree here. My test was simply:
```html
<!doctype html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<pre></pre>
<script>
setInterval(() => {
  document.querySelector('pre').textContent = `screen.width = ${screen.width}
screen.height = ${screen.height}
window.orientation = ${window.orientation}`;
}, 100);
</script>
```

Testing this on Chrome for Android and Safari on iOS, I observe that:
- On Chrome, `screen.width` and `screen.height` flip when rotating the phone
- On Safari, `screen.width` and `screen.height` stay the same
- Chrome and Safari agree on what `window.orientation` should be, happily

Is the spec unambiguous on this point? I ask because I can't find any open WebKit bug about this, so I'm doubting the right behavior. (In my reading of the spec, maybe both are allowed?)

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5204 using your GitHub account

Received on Friday, 12 June 2020 12:11:46 UTC