[whatwg] Forcing orientation in content

Jonas Sicking jonas at sicking.cc
Fri Jul 12 20:25:57 PDT 2013


On Fri, Jul 12, 2013 at 12:45 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Thu, 18 Apr 2013, David Bruant wrote:
>>
>> Currently working on a web project where tablet support (iPad
>> especially) is important, I'm facing a need which apparently the
>> platform doesn't support. I would need to lock the screen in landscape
>> mode.
>
> Why? As a user on desktop, I can resize my window however I want, to be
> landscape or portrait. Why wouldn't I be allowed to do the same on any
> other device?

If the content is sized better for portrait or landscape, then it's
generally good for the user if the mode is forced by the application.
Otherwise the user will have to scroll, or will see content that is
smaller than it otherwise would be.

Users can't always rotate the screen themselves to control this since
many times users disable screen rotation controlled by gravity. Common
cases when this is done is if they find that the screen too often
erratically rotates due to the user moving around the device. Another
scenario is if laying down with the device in bed in which case
rotating according to gravity will result in a screen that is off by
90 degrees from the users orientation.

The reason we don't do this on desktop systems is that desktop
platforms generally don't let the user adjust to an application
rendering itself sideways to fit in the current window size. On
tablets and mobile platforms, there is an established UI paradigm of
simply rotating the device when content renders itself sideways.

If we don't provide webplatform support for setting orientation,
content will simply use things like CSS transformation to render
itself sideways. This results in a much poorer experience for the user
since it interacts poorly with for example gravitational orientation.
I.e. the user might see the content sideways, then rotate the device
in order to see the content correctly, resulting in the device then
changing rendering orientation. The page will then detect this and
undo the transformation. The result is a lot of back and forth which
is disruptive to the user.

Another problem that is likely to occur is authors accidentally
applying CSS transformation in on devices where the user can't
reorient the device.

Not to mention that using CSS transformation will likely result in
content that has to use more javascript driven layout with all the
downsides that come with that.

By supporting pages setting the orientation we can put the user more
in charge by ignoring that orientation when appropriate. Such as on
devices where changing the orientation is bad, or when the user has
explicitly requested the orientation not to change.

In Firefox we have implemented the screen orientation spec
https://dvcs.w3.org/hg/screen-orientation/raw-file/tip/Overview.html

However I personally would like to see declarative support in addition
to the script API.

/ Jonas



More information about the whatwg mailing list