Skip to content

fix(compass): guard DeviceOrientationEvent lookup#420

Merged
KristjanESPERANTO merged 1 commit intodomoritz:gh-pagesfrom
KristjanESPERANTO:orientation
May 4, 2026
Merged

fix(compass): guard DeviceOrientationEvent lookup#420
KristjanESPERANTO merged 1 commit intodomoritz:gh-pagesfrom
KristjanESPERANTO:orientation

Conversation

@KristjanESPERANTO
Copy link
Copy Markdown
Collaborator

In some environments, orientation events are present in window but the DeviceOrientationEvent constructor is not defined as a global - triggering a ReferenceError when the compass is activated. This seems to affect a subset of Firefox users on Linux (reported with Firefox 149).

The fix reads DeviceOrientationEvent safely via window instead of as a bare identifier, so the compass fails gracefully without breaking geolocation.

Includes a regression test for this case.

Closes #419

Avoid ReferenceError in environments where orientation events may
exist but the global DeviceOrientationEvent constructor is missing
(e.g. Firefox/Linux variants).

Add a regression test for the undefined-global case.

Refs domoritz#419
@KristjanESPERANTO KristjanESPERANTO merged commit 6c9b0b1 into domoritz:gh-pages May 4, 2026
1 check passed
@KristjanESPERANTO KristjanESPERANTO deleted the orientation branch May 4, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ReferenceError: DeviceOrientationEvent is not defined

2 participants