Skip to content

Research and redesign accelerometer permission, calibration, and smoothing #24

@Jesssullivan

Description

Problem

Device motion currently requests permission during initialization and again after a timeout. Modern mobile browser behavior requires explicit user activation for permission prompts, so automatic initialization is likely unreliable on iOS/Safari and uneven elsewhere.

Scope

  • Separate capability detection from permission request and listener startup.
  • Add an explicit user-activation entrypoint for permission.
  • Add calibration/zeroing so resting device orientation does not inject drift.
  • Smooth and clamp gravity/tilt using a deterministic filter that can be unit tested.
  • Keep graceful fallback for unsupported or insecure contexts.

Research references

  • MDN DeviceMotionEvent.requestPermission() user activation and secure-context requirements.
  • W3C Device Orientation and Motion coordinate systems and acceleration semantics.

Validation

  • Unit tests for normalization, smoothing, permission state transitions, and fallback behavior.
  • Manual mobile HTTPS test plan for iOS Safari and Android Chrome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions