Provides semantic haptic feedback for web interactions through CSS and JavaScript, allowing web apps to trigger platform-appropriate tactile effects such as hints, ticks, alignment confirmations, and boundary signals. Developers can express haptic intent instead of creating device-specific vibration patterns, enabling consistent tactile feedback across desktop and mobile platforms. The API supports both declarative CSS-based haptics for common UI state changes and imperative JavaScript control for interaction logic that requires runtime decisions, while respecting platform settings.
Web developers currently have limited options for providing tactile feedback. The existing `navigator.vibrate()` API is mobile-centric, lacks broad platform support, and requires developers to define low-level vibration patterns rather than expressing the intended feedback effect. Developers also have no declarative way to associate haptics with common UI interactions such as scroll snapping, button presses, panel transitions, or form validation without introducing JavaScript. The Web Haptics API provides a semantic, cross-platform model for haptic feedback. Developers can request platform-appropriate effects such as hints, ticks, alignment confirmations, and boundary signals, while user agents map those effects to the capabilities of the underlying operating system and hardware. The API includes both a JavaScript interface for dynamic interactions and a CSS-based mechanism that enables low-latency haptic feedback directly from UI state changes. This approach aligns haptic authoring with developer intent, respects platform settings, and reduces the need for device-specific vibration tuning.