Skip to content

Commit

Permalink
DeviceOrientationEvent: Define absolute's value on error (#139)
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
Raphael Kubo da Costa authored Feb 14, 2024
1 parent 39442a2 commit c0f629e
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 @@ -389,10 +389,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/absolute}} attribute set to false.
<h3 id="deviceorientationabsolute">deviceorientationabsolute Event</h3>
Expand All @@ -419,10 +418,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/absolute}} attribute set to true.
<h3 id="devicemotion">devicemotion Event</h3>
Expand Down

0 comments on commit c0f629e

Please sign in to comment.