A Play button that walks a set of steps on its own and stops at the end or on interruption.
<div data-cap="step-player" id="player" data-step-interval="400">
<p><button class="cap-btn" type="button" data-step-play hidden>Play</button></p>
<nav class="cap-btn-group" aria-label="Steps">
<a class="cap-btn" href="#step-1" data-step-go="1">Step 1</a>
<a class="cap-btn" href="#step-2" data-step-go="2">Step 2</a>
<a class="cap-btn" href="#step-3" data-step-go="3">Step 3</a>
</nav>
<p data-step id="step-1">A draft is saved.</p>
<p data-step id="step-2" hidden>The checks run on the draft.</p>
<p data-step id="step-3" hidden>The post is published.</p>
</div>
Installation
// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import { enhance } from "capsomer/behavior/step-player";
enhance();API reference
Functions
| Function | Signature | Does |
|---|---|---|
stepDelay | (interval?: number, reducedFactor?: number, reduced?: boolean): number | The wait on a step: read at each start, so a preference changed mid-page is honored next play. |
stepPlayer | (options: StepPlayerOptions): StepPlayer | |
enhance | (root?: ParentNode): () => void | Attaches a player to every [data-cap="step-player"] root: its steps are the [data-step] children (one shown, the rest hidden), its button [data-step-play]. A key pressed in the root, or a click on a [data-step-go] link, stops it: the person has taken over. |
Accessibility
| Key | Does |
|---|---|
| Enter or Space on the button | Plays or pauses |
| Any key in the player | Stops it |
No manual NVDA or VoiceOver run is planned (decision of 2026-11-07); the automated browser checks and a front-end review stand in.