Skip to content

iOS Bug: When debug: true is set, only the second tap triggers a haptic feedback #31

@dmnkwrl

Description

@dmnkwrl

debug: true prevents first haptic trigger on iOS Safari

Description

When using createWebHaptics({ debug: true }), the first haptic trigger doesn't work on iOS Safari. The second and all subsequent triggers work fine.

Steps to Reproduce

  1. Initialize: const haptics = createWebHaptics({ debug: true });
  2. Trigger on click: haptics.trigger([{ duration: 50 }]);
  3. Tap button after page load

Expected Behavior

Haptic fires on first tap

Actual Behavior

First tap has no haptic, second tap works

Workaround

Use debug: false - then first tap works correctly.

Root Cause

iOS Safari requires audio elements to be "unlocked" within a direct user interaction event. The debug logging appears to introduce enough delay that iOS considers the haptic trigger too late, causing it to be rejected on the first interaction. The second tap works because the audio element is already unlocked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions