Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web Haptics API

Authors: Nesh Gandhe, Kevin Babbitt, Limin Zhu

Status of this Document

This document is a starting point for engaging the community and standards bodies in developing collaborative solutions fit for standardization. The API is in the early ideation and interest-gauging stage, and the solution/design will likely evolve over time.

  • This document status: Active
  • Current version: This document

Table of Contents

Introduction

Modern operating systems have embraced haptics as a core part of user experience — providing subtle, low-latency tactile cues that reinforce visual and auditory feedback. These signals improve confidence, precision, and delight in everyday interactions. The Web Haptics API proposes a semantic, cross-platform interface that connects web applications to native haptic capabilities. By focusing on intent-driven effects, the API enables web apps to deliver tactile feedback consistent with OS design principles, while preserving user privacy and security.

This proposal offers two complementary mechanisms:

  1. Declarative API (CSS) — a nested @haptic at-rule inside style rules that fires haptic effects when the rule starts matching.
  2. Imperative API (JS)navigator.playHaptics(effect, intensity) for interactions that require runtime logic or have no corresponding CSS state change.

User-Facing Problem

The navigator.vibrate() API exists today for basic haptics. However, it is mobile-centric, lacks broad engine and device support, and requires developers to manually program duration/pattern sequences — a low-level interface that doesn't map to the way designers think about haptic intent.

Beyond the limitations of the existing API, there is no declarative way for developers to add haptic feedback to common UI interactions — scroll-snap carousels, panel transitions, form validation — without JavaScript in the critical path.

Goals

  • Bring standardized, semantic haptic feedback to web apps across desktop and mobile platforms.
  • Allow developers to signal intent/effect rather than programming raw patterns.
  • Focus on reactive haptics feedback (i.e. haptics immediately after user input).
  • Enable low-latency haptic feedback for common interactions without requiring JavaScript.
  • Extensible interface for future haptics advancement on the web.
  • Respect platform haptics user settings if available.
  • Minimize privacy/fingerprinting concerns.

Non-goals

  • Guarantee identical tactile output across platforms — different platforms and user agents may choose varied output that best matches the intent.
  • Cover haptics notification scenarios (e.g. vibrate to alert users when long-running task is completed).
  • Cover/replace API for highly specialized hardware, namely gamepad.

Proposed Approach