InputLightweight
Haptics
Vibration as feedback.
Vibration as feedback: a tick on a toggle, a buzz on a controller. Works on Android and in VR; iPhone Safari ignores it. A bonus layer, never the only feedback.
- Breaks when
- iOS Safari ignores vibrate()
- Also called
- navigator.vibrate, vibration API
Prompts
Haptic vocabulary for a mobile UI
A tiny haptics module: tick() = vibrate(8), confirm() = [12, 30, 12], error() = [40, 40, 40, 40, 40], each guarded by a feature check and a user setting stored in localStorage. Attach tick to toggles and confirm to a submit. Never call vibrate before the first user gesture. Explain that iOS Safari ignores it and how to keep the visual feedback equivalent.
XR haptics on contact
In WebXR, pulse the controller when its ray enters a target (0.3 intensity, 20 ms) and on select (0.8, 60 ms); scale a continuous rumble with the speed of a dragged object (pulse every 50 ms at min(1, speed / 2)). Guard for controllers without hapticActuators.
Rhythm as haptic + visual
Synchronize a vibration pattern with a visual pulse: build the pattern array from a BPM (on 40 ms, off 60000 / bpm − 40), start both from the same timestamp, and show drift after 30 s. Explain why vibration timing is unreliable and how to re-sync on each bar.
Related
Resources · 1
- MDN: Navigator.vibrate()mdnsite · codeApr 10, 2026