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.

fix: keep Slide Transition's parked pages out of the accessibility tree, mark the current page name, and define the names in its README snippet

matina8de585f9dba
diff --git a/animations/03-page-transitions/slide-transition/README.md b/animations/03-page-transitions/slide-transition/README.md
index f8dcc341..2f5b8119 100644
--- a/animations/03-page-transitions/slide-transition/README.md
+++ b/animations/03-page-transitions/slide-transition/README.md
@@ -18,7 +18,8 @@ function getDir(prev,next){
return next>prev ? -1 : 1; // auto: forward = left(-1), back = right(+1)
}
-function doTransition(prev,next){
+function doTransition(prev,next,dur,stagger,ease){
+ const oldEl=pages[prev], newEl=pages[next];
const d=getDir(prev,next), dir=Math.abs(d)===2?'Y':'X', sign=d<0?-1:1;
newEl.style.transition='none';
newEl.style.transform=`translate${dir}(${sign*-100}%)`; // park off-screen, opposite edge
diff --git a/animations/03-page-transitions/slide-transition/index.html b/animations/03-page-transitions/slide-transition/index.html
index 290715a5..d73fd487 100644
--- a/animations/03-page-transitions/slide-transition/index.html
+++ b/animations/03-page-transitions/slide-transition/index.html
@@ -197,12 +197,13 @@
if(i>-1)timers.splice(i,1);
}
- function updateNav(n){navBtns.forEach((b,i)=>b.classList.toggle('active',i===n))}
- // One page's resting look: the page shown sits in place, the others are parked to the right, with nothing left over from a
- // slide (its background stays). A slide that is already heading for the same place keeps its own length when its inline
- // transition goes, so it is cancelled too.
+ function updateNav(n){navBtns.forEach((b,i)=>{b.classList.toggle('active',i===n);b.setAttribute('aria-current',i===n?'page':'false')})}
+ // One page's resting look: the page shown sits in place, the others are parked to the right and inert (out of the Tab
+ // order and the accessibility tree), with nothing left over from a slide (its background stays). A slide that is already
+ // heading for the same place keeps its own length when its inline transition goes, so it is cancelled too.
function rest(el,on){
el.classList.toggle('active',on);
+ el.inert=!on;
el.style.transition='';el.style.pointerEvents='';
el.style.transform=on?'':'translateX(100%)';
el.getAnimations().forEach(a=>a.cancel());
diff --git a/docs/superpowers/plans/2026-09-29-transitions-content.md b/docs/superpowers/plans/2026-09-29-transitions-content.md
index 404e1aed..132d1971 100644
--- a/docs/superpowers/plans/2026-09-29-transitions-content.md
+++ b/docs/superpowers/plans/2026-09-29-transitions-content.md
@@ -463,6 +463,7 @@ None: leave out the `details.hb-options` block.
- [Elastic Transition](../elastic-transition/) — the slide with a springy finish
- **README How it works:**
- In the snippet, `getDir()` reads `dirMode` in place of `dirMode.value`, and its first line (`const m=dirMode.value;`) goes, so its checks read `dirMode==='ltr'` and so on. `easeSel.value` becomes `ease`.
+ - The snippet's `doTransition` takes the values it reads as the page's does, and defines the two pages it moves: its first line is `function doTransition(prev,next,dur,stagger,ease){`, followed by ` const oldEl=pages[prev], newEl=pages[next];`. Before, `oldEl`, `newEl`, `dur`, `stagger` and `ease` were not defined anywhere in it.
- The `requestAnimationFrame(()=>requestAnimationFrame(()=>{ … }));` wrapper is replaced by a reflow, with the four lines it held following directly:
```js
@@ -477,6 +478,7 @@ None: leave out the `details.hb-options` block.
- **README Production notes:** the bullet "**The double `requestAnimationFrame`** is required…" becomes "**Commit the parked position.** Reading `offsetWidth` after parking the new page off-screen makes the browser apply that position before the transition is switched on; without it the two writes merge and the new page jumps straight in with no slide." In the bullet "**Match direction to platform expectation.**", "The auto mode encodes this." becomes "The Forward and back setting encodes this." The rest is unchanged.
- **Category line:** `03.05 · Page Transitions`
- **Pager:** Previous: Crossfade Transition (`../crossfade/`) · Next: Zoom Transition (`../zoom-transition/`)
+- **Final fix wave:** `rest()` sets `inert` on a page that is not on show (the pages parked to the right), so a screen reader reads only the page on show and Tab cannot enter a parked one. The name of the page on show carries `aria-current="page"` and the other two `"false"` (`updateNav`).
---