Viewport Orientation

Hi,

As a mobile web developer, the W3C Geolocation APIs have brought
great opportunities for innovation to the browser. I would like to thank
the working group for all the time and effort involved.

Unfortunately the the most recent specification, Device Orientation has
proven to be the most frustrating to implement successfully e.g. the alpha
returned by iOS5's event handler is not standard.

My main reason for posting to this list is to enquire about how it is
proposed that useragents should handle the difference between the device
orientation and the UA/viewport's orientation?
I cannot seem to find any reference to this issue or any proposed solutions
in the current draft. This discrepancy comes to light when attempting to
build a browser based compass.

For example a browser loads said compass on a phone with a default portrait
orientation. A user holding the device faces north and the compass needle
points north. The user then rotates the device 90deg to the left, the UA
changes the viewport to a landscape orientation, however the compass now
points east.

There are two potential solutions to this issue:
1. Make the viewport's orientation available to the DOM through either a
variable such as window ViewportOrientation (similar to iOS's
implementation) or return the value to a handler using
window.onorientationchange whenever the orientation event fires.
2. The UA calculates the compass heading as a seperate return value, based
on the device and viewport orientation, thus negating the need for a
seperate variable and simplifying the code required by javascript
developers.

In my humble opinion, I believe the specification's title 'Device
Orientation' has lead to confusion in the implementation, as what is
actually required is a 'Viewport Orientation' specification, with the
user/developer abstracted away from the device's orientation.

Yours,
Paddy O'Reilly

Received on Sunday, 4 March 2012 06:23:36 UTC