[whatwg] A question about portrait-secondary of screen orientation

Mounir Lamouri mounir at lamouri.fr
Thu Apr 4 05:23:58 PDT 2013

On 08/02/13 17:53, Chundong Wang wrote:
> Hello - Got a question of screen orientation on portrait/landscape.
> Let's say we have a device doesn't support portrait-secondary, by spec<http://www.w3.org/TR/screen-orientation/> we should remove it from allow list which is fine. However if web developer specified "portrait" instead of "portrait-primary" for lockOrientation(), which I suppose is a common case, we'll have to expand it to "portrait-primary, portrait-secondary" according spec. In this case the lockOrientation() would fail because orientations isn't a supported orientation set. I don't think it'll satisfy the original purpose of "portrait".
> IMHO, we should explain this more detailed.  We could either,
> 1.       Only expand "portrait"(or "landscape") into allowed orientations, or;
> 2.       Filter out disallowed orientations from orientation sequence and lock the screen with that list.

Thank you for your feedback, it is quite interesting. I went with the
first solution you proposed. The only down-side with that solution is
that lockOrientation("portrait") would no longer be exactly like
lockOrientation(["portrait-primary", "portrait-secondary"]) but I guess
this is better for developers who don't care which portrait orientation
are allowed exactly. I am assuming that someone using the explicit form
might want to know if that failed and wouldn't prefer a half-working
lock without notification.

You can view the updated document here :

By the way, this specification is being worked on in the WebApps WG so
posting in the webapps mailing-list would have been better ;)


More information about the whatwg mailing list