# A demo should let go

Greyscale, Issue 02 "Show the change", chapter 1 of 2. By Murat Alpay, 21 Nov 2026.
Source: https://greyscale.muratalpay.me/issues/02/a-demo-should-let-go

When I write about an interface, the demo is the argument, and both usual options fall short. A video shows the gesture, but you can't touch it. A live component can be touched, but nobody knows where to start.

So I wrote a small library that replays a recorded cursor over the real component once, then hands it over. It isn't public yet. Here is how it works, the problem that made it interesting, and when I'd skip it.

## Show the gesture once, then give it back

A video loops. The reader watches the gesture again and again and never gets to try it. A live component waits. A reader who doesn't know the gesture scrolls past it.

Showing once sits between the two. When the demo is half in view, a cursor plays the gesture one time over the real control: it moves, hovers, clicks. Then it fades, and the control belongs to the reader. If they move in before the take ends, it stops right there.

> Live demo "letgo-three-ways": open https://greyscale.muratalpay.me/issues/02/a-demo-should-let-go to try it.

Every time I explained an interaction with a GIF, the most important part was missing: the moment you try it yourself and it responds. One replay is just enough to say where to start, and then it gets out of the way. If a recording in your docs would only make the reader want to do the same gesture again, it wants to be the live component with one replay over it.

## Replay real events on the real component

The cursor isn't drawn over a picture. It dispatches real DOM events to the component underneath, so the component reacts exactly as it would to a mouse. Nothing is faked on the component side, so the demo can't drift away from the thing it shows.

Making a recording is meant to be boring:

1. open the page with `?record` in the URL
2. press Record
3. use the component
4. press Stop
5. copy the JSON into the demo

The elements the cursor clicks get a stable id attribute, and the recording refers to them by that name. A position is a weak reference. Add one button to a toolbar after you record, and a click stored as a position lands on its neighbor.

Here is a take from the library's own docs site, a sort menu. It doesn't store clicks as positions on the toolbar. It names the controls, then stores each click as an index into that list:

```json
{
  "v": 1,
  "targets": ["@sort-trigger", "@sort-oldest", "@sort-alpha"]
}
```

The cursor opens the menu with `@sort-trigger`, picks `@sort-oldest`, opens it again, and picks `@sort-alpha`. If I add a button to the toolbar later, those names still find the same controls. I give every element the gesture touches a name like this before I record, so the take survives a layout change.

> Live demo "letgo-by-name": open https://greyscale.muratalpay.me/issues/02/a-demo-should-let-go to try it.

## A script can't hover

This was the interesting part. A script can't switch on `:hover`, `:active` or `:focus`. So a replayed cursor can click things, but the states that make an interface feel alive don't light up. The cursor rests on an option and the option doesn't notice.

The fix is to mirror those states as data attributes, and style them right next to the real ones:

```css
.option:hover,
.option[data-ghost-hover] { background: var(--tint); }
```

One rule, two sources. The ghost and the real pointer get the same hover, and the style lives in one place. Press and focus get the same treatment. Each `:hover`, `:active` and `:focus-visible` in the component's CSS is a state a replay will skip until it has a mirror next to it.

> Live demo "letgo-hover": open https://greyscale.muratalpay.me/issues/02/a-demo-should-let-go to try it.

## Decide when the replay stops

A demo that moves on its own should know when not to. Mine:

- start only when the demo is half in view, and play once
- pause offscreen and in hidden tabs
- with reduced motion, show the first frame and a Play button instead of playing
- pause with Space while the pointer is over the demo, and offer a scrubber that works with the arrow keys
- stop on the spot when the reader moves in, presses or focuses inside, and keep whatever the take already changed

> Live demo "letgo-stop": open https://greyscale.muratalpay.me/issues/02/a-demo-should-let-go to try it.

None of these are the feature. All of them decide whether the feature is welcome on the page.

The fiddly one is what counts as moving in. A pointer already resting over the demo when the take starts hasn't arrived. Once it moves, it has. If I can't list the moments a moving demo should stop, I don't let it autoplay.

## When this is overkill

If the gesture is one obvious click, the live component alone is enough. A replay tells the reader where to start, and a lone button already does.

Where there's no pointer at all, like a slide, an email or a printed page, a still image with a short caption does the job.

A recording is also tied to the component. Stable names survive a layout change, but a changed gesture needs a new take. If the component still changes every day, record it last.

## What I don't know yet

I don't know how many readers move in before a take ends, or whether they notice the hand-off at all. I haven't measured either. Next I want to try shorter takes, one gesture and a stop, and see whether the "your turn" label after the hand-off is still needed.

The demo's job is to show the gesture once, then let go.
