Screen Orientation API Spec (from phrasing confusion)

As a follow from the cc of my post by Arthur from the main list:
http://lists.w3.org/Archives/Public/public-webapps/2014JanMar/0471.html

I'd like to point out the following for the Screen Orientation API with my
reading of previous fairly recent posts from the archives:

Unless I am missing, something my current issue with screen.orientation is
that it does not actually specify which is the "natural" orientation right
away, UNLESS the device is rotated once. Is this really by design?
Ref. again: 
http://msdn.microsoft.com/en-us/library/ie/dn433241(v=vs.85).aspx

That seems to defeat the "normal orientation" aspect of the spec and the
usefulness of '-primary' and '-secondary' suffixes "for the initial state".

On Wed, Nov 6, 2013, at 11:17, Jonas Sicking wrote:
> Last I looked the property was useless because window.orientation=0
> meant different things on different devices. I.e. on some devices it
> meant "landscape mode" and others it meant "portrait mode".

It's not completely useless because one can tell the initial orientation
by other means. (either media queries or deduction from screen
width/height)

As per Mounir, 0 indicates the natural orientation, which
screen.orientation lacks as best illustrated by M. Gifford:
http://www.matthewgifford.com/blog/2011/12/22/a-misconception-about-window-
orientation/

Based on the above, the implied official specs of window.orientation is
quite consistent with legacy implementations.

>So unless webcompat at some point requiring it, I don't see us adding it.

I think it should be, because the screen orientation API lack the
'natural' orientation, at the moment anyway. I was actually trying to
somehow polyfill the [0,90,-90,180] of window.orientation with
screen.orientation. But I cannot account for the 0 (normal orientation)
due to the initial orientation value having two definitions. :\

And honestly with screen.orientation, I currently have to write 12 lines
of code to deduct whether the device was turned left of right, from the
initial state, as opposed to the more straight forward window.orientation
for that particular goal.

>window.screen.orientation seems like a better way forward.

The two have different meanings. From a legacy standpoint
window.orientation implies a mobile device (i.e where the screen is
attached to the device), and to that effect is only implemented on mobile
browsers[1]. (And while there is 'DeviceOrientation' Events for mobile
devices that's an overkill for simple web sites use. /aside)

Whereas screen.orientation applies to all screens regardless of the device
type. That worth a distinction and a specificity that could help us
identify mobile devices vs desktop on the long term, if "IEMobile" and
"Fennec" implemented window.orientation for mobile.

On Wed, 06 Nov 2013 11:27:08,Mounir Lamouri wrote:
>Indeed, if I remember correctly, window.orientation=0 is the "natural"
>orientation and then, the value is the angle between the current
>orientation and the natural one in the range ] -180 ; 180 ].

Mounir, note that there is no -180 angle, as far as I know.

I think that -180 only applies to DeviceOrientation Events.

---

And finally, one question which may or may not depend on implementation:
(latter preferred)

Is the screen.orientationchange event supposed to fire for every rotation
step? Say if the device is rotated fast from upside to upsidedown.
Should or* must* the device fire two events, or can it possibly fire only
Once?

Bruno

[1] http://compatibility.shwups-cms.ch/de/home?&property=orientation

Received on Sunday, 23 February 2014 09:12:55 UTC