Skip to content

feat(a11y): Add animation toggle and rewire motion system to data attrs#38

Merged
Luzkan merged 1 commit into
mainfrom
feat/animation-toggle-n-fixes
Mar 29, 2026
Merged

feat(a11y): Add animation toggle and rewire motion system to data attrs#38
Luzkan merged 1 commit into
mainfrom
feat/animation-toggle-n-fixes

Conversation

@Luzkan

@Luzkan Luzkan commented Mar 29, 2026

Copy link
Copy Markdown
Owner

feat(a11y): Add animation toggle and rewire motion system to data attribute
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 https://github.com/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

@Luzkan Luzkan self-assigned this Mar 29, 2026
@vercel

vercel Bot commented Mar 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
smells Ready Ready Preview, Comment Mar 29, 2026 8:03pm

@Luzkan Luzkan changed the title feat(a11y): Add animation toggle and rewire motion system to data att… feat(a11y): Add animation toggle and rewire motion system to data attrs Mar 29, 2026
@Luzkan Luzkan force-pushed the feat/animation-toggle-n-fixes branch from cefdab4 to 13e2deb Compare March 29, 2026 20:01
…ribute

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
@Luzkan Luzkan force-pushed the feat/animation-toggle-n-fixes branch from 13e2deb to 4ba60f5 Compare March 29, 2026 20:02
@Luzkan Luzkan merged commit f93f03b into main Mar 29, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant