Skip to content

176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.

docs: tell the lanes what the scroll and do-it code needs of a page

matina58bd1860ad4
diff --git a/docs/superpowers/plans/2026-09-29-demo-page-kinds-do-and-scroll.md b/docs/superpowers/plans/2026-09-29-demo-page-kinds-do-and-scroll.md
index 5b0e4c90..378e4e2d 100644
--- a/docs/superpowers/plans/2026-09-29-demo-page-kinds-do-and-scroll.md
+++ b/docs/superpowers/plans/2026-09-29-demo-page-kinds-do-and-scroll.md
@@ -69,7 +69,7 @@ git commit -m "test: accept guided-steps pages whose demo has no settings"
- The Show me button, exactly: `<button class="hb-play" type="button" id="btn-demo" data-hb-demo><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/></svg>Show me</button>`. The page's own click handler plays one example of the interaction (about two to four seconds) and returns the demo to rest.
- The Reset button, where the demo has a state to reset, exactly: `<button class="hb-play" type="button" id="btn-reset" data-hb-reset><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>Reset</button>`. The page's click handler returns the demo to its starting state.
- On arrival (body `data-hb-autoplay`, not reduced motion) the shared script presses Show me once, 400ms after load.
- - The document event `hb:input`, sent by the shared script when the visitor presses, types, scrolls or touches inside the stage (trusted `pointerdown`, `keydown`, `wheel` or `touchstart`). A page stops a Show me run that is under way when it receives it, leaving the visitor in control.
+ - The document event `hb:input`, sent by the shared script when the visitor presses, types, scrolls, touches or clicks inside the stage (trusted `pointerdown`, `keydown`, `wheel`, `touchstart` or `click`; the click is there for an activation that comes with no pointer or key event, from assistive technology). A page stops a Show me run that is under way when it receives it, leaving the visitor in control.
- Slow motion may appear on a do-it page where it works (the existing `data-hb-slowmo`, "css" or page mode).
- On phones, two buttons in the player bar share one row.
@@ -193,7 +193,7 @@ git commit -m "feat: support do-it demos with Show me and Reset"
- The Play button, exactly: `<button class="hb-play" type="button" id="btn-scroll" data-hb-autoscroll><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M19 12l-7 7-7-7"/></svg>Play</button>`. The shared script scrolls the box from where it is to its end at a steady speed (the whole box in about six seconds), starting again from the top when it is already at the end.
- The Back to top button, exactly: `<button class="hb-play" type="button" id="btn-top" data-hb-top><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 19V5M5 12l7-7 7 7"/></svg>Back to top</button>`. The shared script stops any automatic scroll and jumps the box to the top.
- The box that scrolls is the `.stage`, or the element marked `data-hb-scroller` when the stage holds its own scroller.
- - The visitor's own wheel, touch, press or key input on the box stops an automatic scroll.
+ - The visitor's own wheel, touch, press, key or click input anywhere in the stage (trusted events only) stops an automatic scroll.
- On arrival (body `data-hb-autoplay`, not reduced motion) the shared script presses Play once, 400ms after load. Under reduced motion nothing scrolls by itself; Play still works.
- [ ] **Step 1: Write the failing page checks**
diff --git a/docs/superpowers/plans/2026-09-29-demo-page-rollout-parallel.md b/docs/superpowers/plans/2026-09-29-demo-page-rollout-parallel.md
index ca35a658..e95b8f8d 100644
--- a/docs/superpowers/plans/2026-09-29-demo-page-rollout-parallel.md
+++ b/docs/superpowers/plans/2026-09-29-demo-page-rollout-parallel.md
@@ -25,7 +25,7 @@
- Text split into letters or changed every frame or keystroke gets `role="img"` and an `aria-label` with the real text; no live region on it.
- Page loops never call `pause()`/`play()` on CSS keyframe animations (that detaches them from `animation-play-state`, which the css Pause relies on); they freeze transitions and timers with the helper.
- The `hb:pause` / `hb:input` listeners are registered at the top level of the page's inline script; the page reaches player controls by their ids, never by `data-hb-*`.
- - `hb:input` can arrive several times for one gesture (a tap sends two; a trackpad sends a stream of wheel events; a held key repeats): the page's handler only stops a Show me run and must be safe to call repeatedly — never a toggle or a counter.
+ - `hb:input` can arrive several times for one gesture (a tap or click sends one for the press and one for the click; a trackpad sends a stream of wheel events; a held key repeats): the page's handler only stops a Show me run and must be safe to call repeatedly — never a toggle or a counter.
- No stage element uses the class names `seg` or `swatches`: the shared stylesheet styles `.hb-page .seg` and `.swatches` for the Try it controls and would restyle a demo's own element.
- A stage control with its own focus look (a field's underline, a switch's track) must beat the site focus ring `body.hb :focus-visible` (specificity 0,2,1), e.g. `.stage .field input:focus-visible{outline:none}`; one that sets its own `outline-offset` must also beat the stage's inset rule `.hb-page .stage :focus-visible` (0,3,0). A control without its own focus look keeps the site ring, drawn inset inside the stage. No page keeps a class the page checks ban anywhere in the file (`lbl`, `note`, `kv`, `btn-row`).
- A page's own step-1 help line stays on one line on laptops — at most about 880px in the site font at 16px (the default loop line is 736px) — or the player bar drops below the first screen.
@@ -33,6 +33,13 @@
- Pointer input comes from pointer events (a tap's follow-up `mousemove` would leave a phantom pointer); phone fallbacks apply when the viewport is at most 600px wide or at most 500px tall, so a phone held sideways gets them; README How it works matches the new code even where the sheet says "the rest is unchanged".
- Slow motion multiplies movements and the timers that wait for them, never holds (pauses), on every kind of page, Show me runs included.
- A "Press Tab" page (Focus Ring) also stops its Show me run when the visitor tabs into the stage (a trusted `focusin` the run did not cause); the run's own `focus()` calls fire trusted `focusin` too, so the page ignores focus moves it made itself (for example with a flag set around its own `focus()` call).
+- What the shared do-it and scroll code needs of a page (from the do-it/scroll plan and its fix rounds):
+ - While Play runs, the shared script marks the scroller `data-hb-autoscrolling` and a shared rule turns CSS scroll snapping off for it (`scroll-snap-type:none !important`), or every step would snap. A page sets its snap type freely, inline or in its own style, but never with `!important`. Keep the first snap point at scroll position 0 (`scroll-padding` when the content is padded), or the re-snap after Back to top rests on the first snap point instead of at 0.
+ - The page's own `.stage` rule (or the element marked `data-hb-scroller`) sets `overflow-y:auto`: the shared default is `overflow:hidden`, which the script can still scroll but the visitor cannot. The browser check fails a scroll page whose box cannot be scrolled by hand.
+ - The scroller sits inside the stage (the visitor's input anywhere in the stage stops Play, a menu or button beside an inner scroller included) and gets `tabindex="0"`, `role="region"` and an `aria-label`, so keyboard users can focus and scroll it; a key stops Play only once focus is inside the stage.
+ - The scroll range is read once, when Play starts, so the scroller needs bottom padding at least as large as any offset a reveal starts from (a card that begins 40px low adds 40px of range that disappears when the card arrives, and the box jerks at the end of the run), or the reveal uses opacity only.
+ - Reset (`data-hb-reset`, the exact template markup, at most one, in the player bar) is allowed on do-it and loop pages. On a do-it page it comes right after Show me and on a loop page right after Pause, so the two buttons share one row on phones.
+ - Every page links the shared-file version `main` uses, `?v=4` now, on both links; not the `?v=3` in the Text & Typography plan's head template ("How to convert a page"). The page checks require one version everywhere; a lane that rebases onto a `main` with a newer version changes its pages to it (the Publish step).
- Lanes never edit `assets/`, `tests/`, `tools/`, another category's folder, or another category's cards in the root `index.html`. A lane that needs a shared change stops and reports it; the coordinator makes it on `main` and merges `main` into every lane.
- Tests: `node --test "tests/*.test.js"` from the lane's worktree root. Browser check: `node tools/check-pages.mjs --base http://127.0.0.1:<lane port> <folder>`.
- Scratch files go in the lane worktree's `.superpowers/scratch/`. Never delete with a wildcard or a command substitution in the path; never write a raw non-breaking space.
diff --git a/docs/superpowers/specs/2026-09-27-demo-page-rollout-design.md b/docs/superpowers/specs/2026-09-27-demo-page-rollout-design.md
index bb901956..ba4ff95d 100644
--- a/docs/superpowers/specs/2026-09-27-demo-page-rollout-design.md
+++ b/docs/superpowers/specs/2026-09-27-demo-page-rollout-design.md
@@ -43,7 +43,7 @@ The shared script still builds nothing inside the stage; it reads and presses co
| `data-hb-loop` | Loop switch (checkbox) | plays once: repeat while checked |
| `data-hb-slowmo` | Slow motion switch (checkbox) | three times slower. With the value `css`, the shared script does it by setting `playbackRate` to one third on every CSS animation and transition inside the stage (including ones that start later). Without a value, the demo does it. |
| `data-hb-pause` | Pause button (its label reads "Pause" or "Play" and its `data-state` "playing" or "paused"; no `aria-pressed`, because the label already says what it does) | loops: pause and resume. With the value `css`, the shared script pauses the stage's CSS animations by putting the class `hb-paused` on the stage, so a demo's own `animation-play-state` (a hover pause, for example) keeps working once the demo plays again. Without a value, the demo does it. Either way the shared script sends a `hb:pause` event on `document` (`detail.paused`), so a demo with its own timers can stop them. |
-| `data-hb-autoscroll` | Play button | scroll: the shared script scrolls the scroller from where it is to the end over about six seconds; any wheel, touch, pointer or key input on it stops the scroll |
+| `data-hb-autoscroll` | Play button | scroll: the shared script scrolls the scroller from where it is to the end over about six seconds; any trusted wheel, touch, pointer, key or click input anywhere in the stage stops the scroll |
| `data-hb-top` | Back to top button | scroll: the shared script stops any automatic scroll and jumps the scroller to the top |
| `data-hb-scroller` | the element that scrolls | scroll: only needed when that element is not the `.stage` itself |
| `data-hb-demo` | Show me button | do it: the demo plays one example of the interaction (about two to four seconds) and returns to rest; the visitor's own input stops it |