Skip to content

Commit

Permalink
DeviceOrientationEvent: Define absolute's value on error
Browse files Browse the repository at this point in the history
We were only requiring alpha, beta, and gamma to be null. It makes sense to
also require implementations to set absolute to the same value as well.

At the time of writing, this is done for completeness' sake though:
- Blink implements this behavior and sets absolute to false when a
  deviceorientation cannot be provided, and to true for
  deviceorientationabsolute events.
- Gecko does not send any events if it cannot provide readings (e.g. when
  there are no sensors available).
- WebKit only ships an iOS implementation, whose IDL does not even have an
  absolute attribute.

Fixes #119.
  • Loading branch information
rakuco committed Feb 13, 2024
1 parent 36b567e commit 06cbad3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,9 @@ Whenever a <a>significant change in orientation</a> occurs, the user agent must

<!--
* https://github.com/w3c/deviceorientation/issues/118: Does this mean a single event should be fired?
* https://github.com/w3c/deviceorientation/issues/119: Should absolute's value be set here too?
* Should this be a proper <dfn> in an algorithm?
-->
If an implementation can never provide orientation information, the event should be fired with the {{DeviceOrientationEvent/alpha}}, {{DeviceOrientationEvent/beta}} and {{DeviceOrientationEvent/gamma}} attributes set to null.
If an implementation can never provide orientation information, the event should be fired with the {{DeviceOrientationEvent/alpha}}, {{DeviceOrientationEvent/beta}} and {{DeviceOrientationEvent/gamma}} attributes set to null, and the {{DeviceOrientationEvent/absoltue}} set to false.
<h3 id="deviceorientationabsolute">deviceorientationabsolute Event</h3>
Expand All @@ -418,10 +417,9 @@ Whenever a <a>significant change in orientation</a> occurs, the user agent must

<!--
* https://github.com/w3c/deviceorientation/issues/118: Does this mean a single event should be fired?
* https://github.com/w3c/deviceorientation/issues/119: Should absolute's value be set here too?
* Should this be a proper <dfn> in an algorithm?
-->
If an implementation can never provide absolute orientation information, the event should be fired with the {{DeviceOrientationEvent/alpha}}, {{DeviceOrientationEvent/beta}} and {{DeviceOrientationEvent/gamma}} attributes set to null.
If an implementation can never provide absolute orientation information, the event should be fired with the {{DeviceOrientationEvent/alpha}}, {{DeviceOrientationEvent/beta}} and {{DeviceOrientationEvent/gamma}} attributes set to null, and the {{DeviceOrientationEvent/absoltue}} set to true.
<h3 id="devicemotion">devicemotion Event</h3>
Expand Down

0 comments on commit 06cbad3

Please sign in to comment.