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: a group opens at its results, keeps keyboard focus on its chip and has room above its heading on phones

matin23a9480db57b
diff --git a/docs/superpowers/specs/2026-09-30-home-page-redesign-design.md b/docs/superpowers/specs/2026-09-30-home-page-redesign-design.md
index 1bcabf6a..d68251fc 100644
--- a/docs/superpowers/specs/2026-09-30-home-page-redesign-design.md
+++ b/docs/superpowers/specs/2026-09-30-home-page-redesign-design.md
@@ -80,7 +80,8 @@ The view lives in the address, so a view can be shared and **Back** from a demo
`?place=buttons`, `?q=fade%20in`, `?view=all`, with `&all=1` once Show all is pressed. Pressing a tile, Browse all,
Clear or a suggestion adds a history step when it changes the address; typing only replaces the address. Old links
keep working: `?q=` as today, and `?cat=micro-interactions` (the category's name in the form today's chips write it)
-opens All animations at that category's heading.
+opens All animations at that category's heading. (Changed on 2026-11-21: `?cat=` with a group's name now opens that group's
+own view, the one its chip under Good places to start shows; with any other name it still opens All animations.)
## Search
diff --git a/docs/superpowers/specs/2026-11-04-home-sections-design.md b/docs/superpowers/specs/2026-11-04-home-sections-design.md
index 7d41f2fa..9974aad3 100644
--- a/docs/superpowers/specs/2026-11-04-home-sections-design.md
+++ b/docs/superpowers/specs/2026-11-04-home-sections-design.md
@@ -4,6 +4,12 @@ The owner's choice of 2026-11-04, after the study of ten home page designs (`.su
repository): keep the first part of the home page as it is, and take the next sections from two of the designs, Spotlight
and Moments. Where this spec and `2026-09-30-home-page-redesign-design.md` differ, this one wins.
+**Changed on 2026-11-21 (the owner's word):** the chips under Good places to start are no longer the nine places. They are
+All and the seven groups (the entries of `CATS`), each opening its group at `?cat=` and the group's name as a slug; they show
+at Start and on a group, and a place hides them. The line under the heading reads "Eight favorites to try first. Type above,
+or pick a group." Everything this spec says about place chips under the heading describes the page before that day;
+`CLAUDE.md` (Taxonomy) and the tests have the rule now.
+
## The page, top to bottom
1. **As before:** the top bar, the hero (pill, heading, line, search, Popular, "Don't know the name? Find it") and the nine
diff --git a/index.html b/index.html
index 3ccd3b83..a025917d 100644
--- a/index.html
+++ b/index.html
@@ -212,7 +212,6 @@ button,input{font:inherit;color:inherit}
.spot[aria-pressed="true"]{border-color:var(--ink);background:var(--ink);color:var(--bg)}
@media(hover:hover){.spot:hover{border-color:var(--ink)}}
.grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:24px}
-.group{scroll-margin-top:12px}
.group+.group{margin-top:56px}
.ghead{display:flex;align-items:baseline;flex-wrap:wrap;gap:6px 12px;margin-bottom:20px;font-weight:800}
.gnum{font-size:26px;color:var(--muted);font-variant-numeric:tabular-nums}
@@ -327,6 +326,7 @@ button,input{font:inherit;color:inherit}
.pl-name{margin-top:8px;font-size:14px}
.pl-count{margin-top:2px;font-size:12px}
.results{scroll-margin-top:0}
+ .results.grouped{scroll-margin-top:12px} /* a group has no slim bar: its heading stops 12px below the top, as on larger screens */
.results.filtered .pinbar{position:sticky;top:0;z-index:20;display:flex;flex-direction:column;gap:10px;margin:0 calc(-1 * var(--gut)) 16px;padding:10px var(--gut) 12px;background:var(--surface);border-bottom:1px solid var(--line);box-shadow:0 4px 16px rgba(22,22,27,.06)}
.pinrow{display:flex;align-items:center;gap:8px}
.pin-back{display:grid;place-items:center;width:44px;height:44px;flex:none;border-radius:999px;border:1px solid var(--line);background:var(--surface);cursor:pointer}
@@ -340,7 +340,6 @@ button,input{font:inherit;color:inherit}
.spots{flex-wrap:nowrap;margin:-4px calc(-1 * var(--gut)) 16px;padding:2px var(--gut) 4px;overflow-x:auto;scrollbar-width:none}
.spot{min-width:44px;min-height:44px;justify-content:center}
.results.filtered .spots{display:none} /* the slim bar at the top is the way around then */
- .group{scroll-margin-top:136px}
.rhead{margin-bottom:16px}
.grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.card{padding:6px;border-radius:16px}
@@ -3195,7 +3194,7 @@ button,input{font:inherit;color:inherit}
</div>
</div>
<div class="rhead">
- <div><h2 class="rtitle" id="results-title" tabindex="-1">Good places to start</h2><p class="rsub" id="results-sub" aria-live="polite">Eight favorites from different groups. Type above, or pick a group.</p></div>
+ <div><h2 class="rtitle" id="results-title" tabindex="-1">Good places to start</h2><p class="rsub" id="results-sub" aria-live="polite">Eight favorites to try first. Type above, or pick a group.</p></div>
<button type="button" class="pillbtn" id="clear-view" hidden><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>Clear</button>
</div>
<div class="spots" id="spots" role="group" aria-label="Groups">
@@ -4989,7 +4988,7 @@ function showGroups(){
const boxes=[],cards=[];
CATS.forEach(cat=>{
const list=ALL.filter(e=>e.cat===cat),box=document.createElement('section');
- box.className='group';box.id='cat-'+slugify(cat.name);
+ box.className='group';
box.innerHTML=`<h3 class="ghead"><span class="gnum">${cat.n}</span><span class="gname">${esc(cat.name)}</span><span class="gcount">${list.length} animations</span></h3>`;
const grid=document.createElement('div');grid.className='grid';
list.forEach(e=>{const c=CARD[e.slug];c.querySelector('.title').setAttribute('aria-level','4');grid.appendChild(c);cards.push(c);});
@@ -5005,7 +5004,7 @@ const q=$('q'),q2=$('q2'),qClear=$('q-clear'),titleEl=$('results-title'),subEl=$
let moreAction='all';
const pinbar=$('pinbar'),spotsEl=$('spots');
// The phone bar is there while a search, a place or All animations is open and while its own search box has focus, so emptying the box does not take the box away; never in the finder, and not on a group, whose chips stay under the heading.
-const syncBar=()=>resultsEl.classList.toggle('filtered',state.view!=='find'&&(!!(state.q||state.place||state.view)||document.activeElement===q2));
+const syncBar=()=>resultsEl.classList.toggle('filtered',state.view!=='find'&&(!!(state.q||state.place||state.view)||!state.cat&&document.activeElement===q2));
// A pressed button that goes away with the view hands keyboard focus to the results heading. No scrolling: the callers that move the page scroll it themselves.
const toTitle=()=>titleEl.focus({preventScroll:true});
const gone=el=>!el.getClientRects().length;
@@ -5025,13 +5024,14 @@ function render(answered){
}else if(state.view==='all'){
title='All animations';sub=ALL.length+' animations in '+CATS.length+' groups.';
}else{
- list=PICKS.map(s=>BY_SLUG[s]);title='Good places to start';sub='Eight favorites from different groups. Type above, or pick a group.';
+ list=PICKS.map(s=>BY_SLUG[s]);title='Good places to start';sub='Eight favorites to try first. Type above, or pick a group.';
}
titleEl.textContent=title;say(sub,finding&&answered);
showFinder(finding,found);
showNotHere(finding,found);
syncBar();
resultsEl.classList.toggle('no-tags',!tags);
+ resultsEl.classList.toggle('grouped',!!state.cat);
clearBtn.hidden=!filtered||finding;
spotsEl.hidden=!!(state.q||state.place||state.view);
if(found)showFound(found);else if(list)showCards(state.all||!filtered?list:list.slice(0,PAGE));else showGroups();
@@ -5045,16 +5045,19 @@ function render(answered){
document.querySelectorAll('[data-place]').forEach(b=>b.setAttribute('aria-pressed',String(!state.q&&b.dataset.place===state.place)));
// A group's chip is pressed on its group, All at Start (the chips are hidden everywhere else).
document.querySelectorAll('[data-cat]').forEach(b=>b.setAttribute('aria-pressed',String(!spotsEl.hidden&&b.dataset.cat===state.cat)));
- // The picked chip is scrolled fully into its row (a place in the phone bar, a group under the heading), clear of the row's
- // edge margin; only the row moves, never the page.
+ showChips();
+ [q,q2].forEach(input=>{if(input!==document.activeElement&&input.value!==state.q)input.value=state.q;});
+ qClear.hidden=!q.value;
+}
+// The picked chip is scrolled fully into its row (a place in the phone bar, a group under the heading), clear of the row's
+// edge margin; only the row moves, never the page. Run again once the site font is in: its wider letters move the chips.
+function showChips(){
for(const chip of [pinbar.querySelector('.pchip[aria-pressed="true"]'),spotsEl.querySelector('.spot[aria-pressed="true"]')]){
if(!chip||!chip.getClientRects().length)continue;
const row=chip.parentElement,r=row.getBoundingClientRect(),b=chip.getBoundingClientRect(),edge=parseFloat(getComputedStyle(row).paddingLeft)||0;
if(b.left<r.left+edge)row.scrollLeft-=r.left+edge-b.left;
else if(b.right>r.right-edge)row.scrollLeft+=b.right-(r.right-edge);
}
- [q,q2].forEach(input=>{if(input!==document.activeElement&&input.value!==state.q)input.value=state.q;});
- qClear.hidden=!q.value;
}
// Spaces go in as %20, not +, as the spec shows; readURL() reads both. A press adds a history step only when the address
// changes (the same view written with + counts as the same), and a history call the browser refuses (Safari allows 100 in
@@ -5087,13 +5090,14 @@ function readURL(){Object.assign(state,fromURL());q.value=q2.value=state.q;}
// go() never runs while typing, so both boxes take the new view's words even when one keeps focus (a tap on iOS leaves it there).
function go(next,push){Object.assign(state,{q:'',place:'',cat:'',view:'',all:false,what:'',when:'',how:''},next);q.value=q2.value=state.q;render();writeURL(push);}
const toResults=()=>resultsEl.scrollIntoView({behavior:reduce?'auto':'smooth',block:'start'});
-// A picked place or suggestion brings the results into view at every width, unless their heading already shows in the top 60%
-// of the window (below the phone bar). When the page scrolls, the heading takes keyboard focus, so focus never stays on a
-// control that scrolled away. Returns whether it scrolled.
-function showResults(){
+// A picked place, group or suggestion brings the results into view at every width, unless their heading already shows in the
+// top 60% of the window (below the phone bar). When the page scrolls, the heading takes keyboard focus, so focus never stays on
+// a control that scrolled away; with stay, focus is left where it is (a group's chip, which sits right under the heading and
+// comes into view with it). Returns whether it scrolled.
+function showResults(stay){
const top=titleEl.getBoundingClientRect().top;
if(top>=Math.max(0,pinbar.getBoundingClientRect().bottom)&&top<=innerHeight*.6)return false;
- toResults();toTitle();return true;
+ toResults();if(!stay)toTitle();return true;
}
document.addEventListener('click',e=>{
const tile=e.target.closest('[data-place]');
@@ -5107,7 +5111,7 @@ document.addEventListener('click',e=>{
if(chip){
const key=chip.dataset.cat;
go(state.cat===key?{}:{cat:key},true); // the picked group pressed again, and All, go back to Start, where the page is
- if(state.cat)showResults();
+ if(state.cat)showResults(true);
return;
}
const pick=e.target.closest('[data-q]');
@@ -5235,6 +5239,8 @@ $('find-words').addEventListener('click',()=>{go({},true);scrollTo({top:0,behavi
readURL();
render();
document.documentElement.classList.remove('fd-direct'); // the view is drawn: the page under the top bar shows
+if(state.cat)resultsEl.scrollIntoView(); // an address that names a group opens at that group: nothing above the results shows which one it is
+if(document.fonts&&document.fonts.ready)document.fonts.ready.then(showChips);
(function(){const btn=$('theme-toggle');if(!btn)return;
btn.addEventListener('click',()=>{const next=document.documentElement.dataset.theme==='dark'?'light':'dark';
diff --git a/tests/finder.test.js b/tests/finder.test.js
index 9dafe38f..9e7c704a 100644
--- a/tests/finder.test.js
+++ b/tests/finder.test.js
@@ -530,6 +530,45 @@ test('the phone bar never shows in the finder, even while its own search box has
vm.runInContext('syncBar()', page);
assert.equal(bar.on, want, `${view || 'the start'}, ${focused ? 'its box focused' : 'its box not focused'}`);
}
+ // A group keeps its chips under the heading and shows no bar, not even when Back lands on it while the bar's box has focus;
+ // a place and a search show the bar as before.
+ for (const [next, focused, want] of [[{ cat: 'micro-interactions' }, null, false], [{ cat: 'micro-interactions' }, q2, false],
+ [{ place: 'btn' }, null, true], [{ q: 'fade' }, q2, true]]) {
+ page.state = { ...NONE, ...next };
+ page.document.activeElement = focused;
+ vm.runInContext('syncBar()', page);
+ assert.equal(bar.on, want, `${JSON.stringify(next)}, ${focused ? 'its box focused' : 'its box not focused'}`);
+ }
+});
+
+test('a group chip opens its group and leaves keyboard focus on the chip; the picked chip pressed again, and All, go back to Start', () => {
+ const calls = [];
+ const page = vm.createContext({ document: { addEventListener: (type, fn) => { if (type === 'click') page.click = fn; } },
+ go: (next, push) => { calls.push(['go', JSON.stringify(next), push]); Object.assign(page.state, NONE, next); },
+ showResults: stay => { calls.push(['showResults', stay]); return true; }, gone: () => false, toTitle: () => calls.push(['toTitle']) });
+ vm.runInContext(listener("document.addEventListener('click',e=>{"), page);
+ // A press on a control that carries the attribute named (and no other)
+ const press = (attr, value) => { calls.length = 0; page.click({ target: { closest: sel => (sel === `[${attr}]` ? { dataset: { [attr.replace('data-', '')]: value } } : null) } }); return calls.map(c => c.join(' ')); };
+ page.state = { ...NONE };
+ assert.deepEqual(press('data-cat', 'text-typography'), ['go {"cat":"text-typography"} true', 'showResults true'], 'a chip at Start: its group, the results in view, focus stays (stay = true)');
+ assert.deepEqual(press('data-cat', 'text-typography'), ['go {} true'], 'the picked chip again: Start, and the page stays where it is');
+ page.state = { ...NONE, cat: 'text-typography' };
+ assert.deepEqual(press('data-cat', '3d-advanced'), ['go {"cat":"3d-advanced"} true', 'showResults true'], 'another chip: that group');
+ assert.deepEqual(press('data-cat', ''), ['go {"cat":""} true'], 'All: Start');
+ assert.deepEqual(press('data-cat', ''), ['go {} true'], 'All at Start: still Start');
+ // The place tiles work as before: a press opens the place and brings the results into view with keyboard focus on the heading.
+ page.state = { ...NONE, cat: '3d-advanced' };
+ assert.deepEqual(press('data-place', 'btn'), ['go {"place":"btn"} true', 'showResults '], 'a tile on a group: the place');
+});
+
+test('a group has room above its heading on phones, opens at its results when its address is opened, and its chip is put in its row again once the font is in', () => {
+ const phone = STYLE.slice(STYLE.indexOf('@media(max-width:600px){'));
+ assert.ok(phone.includes('.results{scroll-margin-top:0}\n .results.grouped{scroll-margin-top:12px}') || phone.includes('.results{scroll-margin-top:0}\r\n .results.grouped{scroll-margin-top:12px}'),
+ 'on phones the results stop 12px below the top on a group (no slim bar there), 0 elsewhere');
+ assert.ok(HOME.includes("resultsEl.classList.toggle('grouped',!!state.cat);"), 'the results carry the class grouped on a group');
+ assert.match(HOME, /\nreadURL\(\);\r?\nrender\(\);\r?\ndocument\.documentElement\.classList\.remove\('fd-direct'\);[^\n]*\r?\nif\(state\.cat\)resultsEl\.scrollIntoView\(\);[^\n]*\r?\nif\(document\.fonts&&document\.fonts\.ready\)document\.fonts\.ready\.then\(showChips\);/,
+ 'after the first render: a group address scrolls to its results, and the picked chip is placed again when the font has loaded');
+ assert.ok(HOME.includes("function showResults(stay){") && HOME.includes('toResults();if(!stay)toTitle();return true;'), 'showResults(stay) scrolls without moving keyboard focus');
});
test('the questions are native radios in fieldsets with legends, each named by its words, its picture or icon hidden from screen readers, Not sure last', () => {
diff --git a/tools/check-pages.mjs b/tools/check-pages.mjs
index 0176d9f2..2a88219a 100644
--- a/tools/check-pages.mjs
+++ b/tools/check-pages.mjs
@@ -1398,6 +1398,22 @@ async function homeViewProblems() {
if (again.title !== 'Good places to start' || Math.abs(again.scrolled - seen.scrolled) > 1) problems.push(`the picked tile pressed again: heading "${again.title}", the page scrolled from ${seen.scrolled}px to ${again.scrolled}px`);
}
}
+ // A group chip pressed while the heading is just above the window: the results come into view (the heading in the top 60%)
+ // and keyboard focus stays on the chip, which is still there, right under the heading. An address that names a group opens
+ // with its heading in the first screen.
+ await load('');
+ await evaluate(`(() => { const t = document.getElementById('results-title'); scrollTo(0, scrollY + t.getBoundingClientRect().bottom + 6); })()`);
+ await sleep(200);
+ await evaluate(`(() => { const el = document.querySelector('.spot[data-cat="${group.key}"]'); el.focus({ preventScroll: true }); el.click(); })()`);
+ await still();
+ let seenGroup = await evaluate(`(() => { const t = document.getElementById('results-title'), top = Math.round(t.getBoundingClientRect().top), a = document.activeElement;
+ return { title: t.textContent, top, shown: top >= 0 && top <= innerHeight * .6, focus: a && a.dataset && a.dataset.cat !== undefined ? 'chip ' + a.dataset.cat : (a && (a.id || a.tagName.toLowerCase())) || '' }; })()`);
+ if (seenGroup.title !== group.name || !seenGroup.shown || seenGroup.focus !== 'chip ' + group.key) {
+ problems.push(`a group chip pressed with the heading above the window: ${JSON.stringify(seenGroup)}${seenGroup.shown ? '' : ' (the heading is not in the top 60% of the window)'}${seenGroup.focus === 'chip ' + group.key ? '' : ' (keyboard focus left the chip)'}`);
+ }
+ await load(`?cat=${group.key}`);
+ seenGroup = await heading();
+ if (seenGroup.title !== group.name || !seenGroup.shown) problems.push(`?cat=${group.key}: the heading is at ${seenGroup.top}px, not in the top 60% of the first screen`);
// Old links keep working: ?q= opens the search; ?cat= with a group's name opens that group (above), and with a name that is
// no group All animations, as every ?cat= link once did.
for (const [query, want] of [['?q=fade', 'Results for “fade”'], ['?cat=nothing', 'All animations']]) {
@@ -1527,7 +1543,8 @@ async function homePhoneProblems() {
if (g.title !== 'Good places to start' || !g.chips || g.pressed !== 'false' || g.inside || g.wide) {
problems.push(`phone, group chips at Start: ${JSON.stringify(g)}${g.inside ? ' (the last chip is expected past the edge of its row, which scrolls)' : ''}`);
}
- await press(`.spot[data-cat="${g.key}"]`);
+ // A bare click, with no focus() before it: focus alone would scroll the chip into its row, and this step checks the page's own scroll.
+ await evaluate(`document.querySelector('.spot[data-cat="${g.key}"]').click()`);
await sleep(700);
g = await groupChip();
if (g.title !== g.name || g.pressed !== 'true' || !g.chips || g.bar || !g.inside || g.wide || g.search !== `?cat=${g.key}`) {
@@ -1538,9 +1555,20 @@ async function homePhoneProblems() {
await sleep(300);
g = await groupChip();
if (g.title !== 'Good places to start' || g.pressed !== 'false' || g.search !== '') problems.push(`phone, the picked group chip pressed again: ${JSON.stringify(g)}`);
+ // Pressed while the heading is low in the window (70% down), a chip brings the results up: the heading stops a little below
+ // the top (a group has no slim bar to sit under), not flush against it.
+ await evaluate(`(() => { const t = document.getElementById('results-title'); scrollTo(0, scrollY + t.getBoundingClientRect().top - Math.round(innerHeight * .7)); })()`);
+ await sleep(200);
+ await evaluate(`document.querySelector('#spots .spot[data-cat]:not([data-cat=""])').click()`);
+ await sleep(1300);
+ const up = await evaluate(`({ top: Math.round(document.getElementById('results-title').getBoundingClientRect().top), bar: getComputedStyle(document.getElementById('pinbar')).display !== 'none' })`);
+ if (up.top < 8 || up.top > 40 || up.bar) problems.push(`phone, a group chip pressed with the heading low in the window: the heading stops at ${up.top}px (about 12px below the top is expected)${up.bar ? ', and the slim bar shows' : ''}`);
await open(`?cat=${g.key}`, `?cat=${g.key}`);
g = await groupChip();
if (g.title !== g.name || g.pressed !== 'true' || !g.inside || g.bar) problems.push(`phone, ?cat=${g.key}: ${JSON.stringify(g)}${g.inside ? '' : ' (the pressed chip is not fully inside its row)'}`);
+ // An address that names a group opens at the group: its heading is in the first screen, a little below the top.
+ const first = await evaluate(`Math.round(document.getElementById('results-title').getBoundingClientRect().top)`);
+ if (first < 8 || first > 40) problems.push(`phone, ?cat=${g.key}: the heading is at ${first}px, not near the top of the first screen`);
// A 45-letter word in the address: the headings that repeat it break inside the word, so the page is no wider than the window.
await open('?q=pneumonoultramicroscopicsilicovolcanoconiosis', '?q= with a 45-letter word');
const wide = await evaluate(`({ page: document.documentElement.scrollWidth, window: document.documentElement.clientWidth })`);