Riff / Built on the open web / Media

Vibration

A short tick under the thumb on play and pause.

Now Playing on a phone: the cover, the title and artist, a seek bar, and the play controls
Tapping the play button gives an 8ms tick on a phone.

How Riff uses it

Every play or pause, from a tap, a key or a row, first checks the (hover: none) media query to tell a touch screen from a mouse. On a touch screen it fires an 8ms vibration.

Why

A haptic tick confirms the tap landed. Without it the only confirmation is the icon change.

Without it

The call is optional, so a browser without it skips the tick.

Where

Links open the source at the commit this page was published from.

Reference: Vibration on MDN.