Commit 60e6ced
committed
[
Before: Reduced motion was a one-way street. Users relied on their
OS-level prefers-reduced-motion setting — all-or-nothing, site
can't override, site can't even know they care. Fifteen components
each rolled their own @media block, isolated and untestable.
After: A sparkles toggle in the nav lets users quiet animations on
this site alone, persisted to localStorage. The entire motion system
now flows through a single html[data-motion] attribute, resolved
at page load via blocking script: localStorage first, OS preference
as fallback. One global CSS kill switch forces near-zero durations
on everything (transitions, animations, view transitions) while
each component retains its own reduced-motion overrides for graceful
static states (opacity snaps, transforms reset, cursors hold still).
The toggle practices what it preaches: celebratory bounce when
sparkles come back to life, instant quiet when they go dark.
Architecture mirrors the existing theme system: motion-contract.ts
for shared constants, initAll for lifecycle across view transitions,
astro:before-swap to stamp the new document before paint.
Also while the plumbing was exposed:
- Fix horizontal overflow caused by left/right: -100vw in
CatalogHero and ArticleLayout; use translateX(-50%) centering
- Add tooltip system for nav icon buttons via data-tooltip attribute
with CSS arrow and hover delay, replacing native title attributes
- Fix ThemeToggle spin animation clipping tooltip pseudo-elements;
target inner icons instead of the button, drop overflow: hidden
- Harden mobile nav against view-transition DOM replacement: lazy
element lookups, re-bind listeners on astro:page-load, guard
against duplicate event bindings with data attributes
- Shore up E2E tests for mobile: extract helpers for consent flow,
catalog filter scoping, and stable click-with-scroll patterns;
skip clipboard tests on non-Chromium; add force-click fallbacks
- Fix webkit E2E failure in theme-toggle navigation test:
use scroll-into-view + force-click fallback pattern
- Add CHANGELOG entry for 2.0.12.0.1] feat(a11y): Add animation toggle and rewire motion system to data attribute1 parent d9be345 commit 60e6ced
29 files changed
Lines changed: 845 additions & 301 deletions
File tree
- docs
- src
- components
- about
- catalog
- islands
- shell
- layouts
- lib
- pages
- styles
- tests/e2e
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
9 | 33 | | |
10 | 34 | | |
11 | 35 | | |
| |||
327 | 351 | | |
328 | 352 | | |
329 | 353 | | |
| 354 | + | |
330 | 355 | | |
331 | 356 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1308 | 1308 | | |
1309 | 1309 | | |
1310 | 1310 | | |
1311 | | - | |
1312 | | - | |
1313 | | - | |
1314 | | - | |
1315 | | - | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
1316 | 1315 | | |
1317 | | - | |
1318 | | - | |
1319 | | - | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
1320 | 1319 | | |
1321 | | - | |
1322 | | - | |
1323 | | - | |
1324 | | - | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
1325 | 1324 | | |
1326 | | - | |
1327 | | - | |
1328 | | - | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
1329 | 1328 | | |
1330 | | - | |
1331 | | - | |
1332 | | - | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
1333 | 1332 | | |
1334 | | - | |
1335 | | - | |
1336 | | - | |
1337 | | - | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
1338 | 1337 | | |
1339 | | - | |
1340 | | - | |
1341 | | - | |
1342 | | - | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
1343 | 1342 | | |
1344 | | - | |
1345 | | - | |
1346 | | - | |
| 1343 | + | |
| 1344 | + | |
1347 | 1345 | | |
1348 | 1346 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
373 | 371 | | |
374 | 372 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
| 182 | + | |
| 183 | + | |
186 | 184 | | |
187 | 185 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1335 | 1335 | | |
1336 | 1336 | | |
1337 | 1337 | | |
1338 | | - | |
1339 | | - | |
1340 | | - | |
1341 | | - | |
1342 | | - | |
1343 | | - | |
1344 | | - | |
1345 | | - | |
1346 | | - | |
1347 | | - | |
1348 | | - | |
1349 | | - | |
1350 | | - | |
1351 | | - | |
1352 | | - | |
1353 | | - | |
1354 | | - | |
1355 | | - | |
1356 | | - | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
1357 | 1356 | | |
1358 | | - | |
1359 | | - | |
1360 | | - | |
1361 | | - | |
1362 | | - | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
1363 | 1361 | | |
1364 | 1362 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
172 | 170 | | |
173 | 171 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
627 | 627 | | |
628 | 628 | | |
629 | 629 | | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
635 | 634 | | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
640 | 638 | | |
641 | 639 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
719 | 719 | | |
720 | 720 | | |
721 | 721 | | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
729 | 728 | | |
730 | | - | |
731 | | - | |
732 | | - | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
733 | 732 | | |
734 | | - | |
735 | | - | |
736 | | - | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
737 | 736 | | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
743 | 742 | | |
744 | | - | |
745 | | - | |
746 | | - | |
747 | | - | |
748 | | - | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
749 | 748 | | |
750 | | - | |
751 | | - | |
752 | | - | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
753 | 752 | | |
754 | | - | |
755 | | - | |
756 | | - | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
757 | 756 | | |
758 | | - | |
759 | | - | |
760 | | - | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
761 | 760 | | |
762 | | - | |
763 | | - | |
764 | | - | |
765 | | - | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
766 | 764 | | |
767 | 765 | | |
768 | 766 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
0 commit comments