Skip to content

feat: add haptic feedback to Toggle in Safari on iOS 18+ #29942

Open
@jedlikowski

Description

@jedlikowski

Prerequisites

Describe the Feature Request

Safari since iOS 18 supports haptic feedback on checkbox elements via a non-standard switch attribute. We could use it to provide haptic feedback when switching Toggle in non-hybrid environments. This could be a workaround for lack of support for Vibration API in Safari.

Describe the Use Case

Adding haptic feedback to Toggle component in non-hybrid environments would improve native feel of web and PWA apps built with Ionic.

Describe Preferred Solution

To trigger haptic feedback programatically we need an <input type=checkbox switch> element with an associated <label> element. With this setup, when we programatically trigger click() on the label, safari will emit the haptic feedback.

Describe Alternatives

Keep current implementation and wait for Safari to implement Vibration API (if it ever does).

Related Code

Codepen provided in WebKit release notes, demonstrating haptic feedback in checkbox of type switch: https://codepen.io/jensimmons/pen/GReLKWg

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: feature requesta new feature, enhancement, or improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions