Skip to content

Checklist run

A page of steps worked through once, with Done checks, notes, timers and a record to download.

<article class="run-demo" id="run-demo" data-cap="checklist-run" data-run-noun="checklist" data-run-path="/sample/field-day" data-run-version="1.0" data-run-title="Field day">
  <section aria-labelledby="run-demo-a">
    <h3 id="run-demo-a">Before you go</h3>
    <ol>
      <li data-step="1" id="before-1"><p data-run-text>Pack the notebook and two pencils.</p></li>
      <li data-step="2" id="before-2" data-timers='[{"label":"Charge","text":"2 minutes","min":2,"max":null,"unit":"minutes"}]'><p data-run-text>Charge the camera.</p></li>
    </ol>
  </section>
  <section aria-labelledby="run-demo-b">
    <h3 id="run-demo-b">At the plot</h3>
    <ol>
      <li data-step="1" id="plot-1"><p data-run-text><span data-run-flag="critical">Critical:</span> Photograph every marker before you move it.</p></li>
      <li data-step="2" id="plot-2"><p data-run-text>Write the date and the weather.</p></li>
    </ol>
  </section>
  <p data-run-start></p>
</article>

Installation

// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/checklist-run.css";
import { enhance } from "capsomer/behavior/checklist-run";

enhance();

Usage

<article data-cap="checklist-run" data-run-noun="procedure" data-run-path="/sample/field-day" data-run-version="1.0" data-run-title="Field day">
  <section aria-labelledby="h-before">
    <h3 id="h-before">Before you go</h3>
    <ol>
      <li data-step="1" id="before-1" data-timers='[{"label":"","text":"2 minutes","min":2,"max":null,"unit":"minutes"}]'>
        <p data-run-text>Charge the camera.</p>
      </li>
    </ol>
  </section>
  <form data-run-scale method="get" action=""><input name="scale" value="1" /></form>
  <p data-run-start></p>
</article>

API reference

Functions

FunctionSignatureDoes
start(root: HTMLElement, options?: RunOptions): () => voidMakes root (with data-run-path, data-run-version and data-run-title) runnable. Returns a function that ends the run view and takes every added control away; the stored run stays.
enhance(scope?: ParentNode, options?: RunOptions): () => voidStarts every [data-cap="checklist-run"] in scope, its noun from data-run-noun.

Parts and data attributes

ClassIs
.cap-run-actionsits own class
.cap-run-barthe root
.cap-run-clockits own class
.cap-run-doneits own class
.cap-run-noteits own class
.cap-run-progressits own class
.cap-run-rollits own class
.cap-run-startits own class
.cap-run-step-doneits own class
.cap-run-step-shownits own class
.cap-run-summaryits own class
.cap-run-timerits own class
.cap-run-toolsits own class
.cap-run-warningits own class
AttributeValues
data-runon view
data-run-flagcritical
data-run-textpresent or absent
data-statedone
data-steppresent or absent
data-viewstep
StateRead from
[aria-current="step"]an attribute
[aria-pressed="true"]an attribute
[hidden]an attribute
[open]an attribute

Accessibility

KeyDoes
TabMoves through the bar and each step's Done check, timers and note
SpaceChecks a step done, starts or pauses a timer
  • The current step carries aria-current="step"; the bar's progress line says it in words, and the roll blocks are drawn only.
  • Each change is said in a polite live region; a finished timer is an alert.
  • Each timer button's name starts with its visible words and ends with its step ("Pause (step 2)").