Skip to content

Motion quality: shared tokens, reduced motion, dock and CTA fixes#25

Merged
starc007 merged 8 commits into
mainfrom
polish/motion-quality
Jun 10, 2026
Merged

Motion quality: shared tokens, reduced motion, dock and CTA fixes#25
starc007 merged 8 commits into
mainfrom
polish/motion-quality

Conversation

@starc007

Copy link
Copy Markdown
Owner

What

Polish pass across the motion library and site. Goal: one cohesive motion language, production-ready accessibility, buttery press feel everywhere.

Motion tokens

  • lib/ease.ts is now the single source for easing curves and spring presets (EASE_OUT, EASE_OUT_CSS, SPRING_PRESS, SPRING_SWAP, SPRING_PANEL, SPRING_LAYOUT, SPRING_MOUSE)
  • 21 inline cubic-beziers and 14 near-duplicate spring configs migrated; --ease-out in globals.css synced to the canonical curve
  • Purpose-tuned springs (switch thumb, tabs indicator, palette row) stay local with comments

Reduced motion and touch

  • useReducedMotion added to 12 components that lacked it (the CSS media query cannot stop JS springs)
  • Decorative cursor-follow effects (magnetic, tilt) gated behind useHoverCapable, so touch devices never get sticky phantom hover

Button family

  • StatefulButton and MagneticButton import Button from base.tsx instead of carrying inline copies; the registry import graph bundles dependencies automatically
  • Per-variant install commands: button-base, button-stateful, button-magnetic (same pattern as action-swap)

Dock

  • Found and fixed a dead-code bug: the cloneElement prop-injection check never fired, so Dock context (size, pill id) never reached items
  • Simplified to static item sizes, dropped the magnification machinery
  • DockItem is polymorphic: onClick renders a real button with focus ring and aria-pressed; items wrapping their own link stay a div, so no nested-interactive HTML

Site CTAs

  • New PressLink (motion-wrapped next/link) gives nav and hero CTAs the same SPRING_PRESS feel as the library Button; the flat CSS .press utility is no longer used on primary CTAs

Accessibility

  • Command palette: combobox semantics with aria-activedescendant, listbox and option roles, per-instance ids
  • StatefulButton announces state changes via aria-live
  • Tooltips skip the open delay when another tooltip closed within 300ms

Docs

  • CONTRIBUTING motion conventions section
  • AGENTS.md agent guide, CLAUDE.md imports it

Verification

  • bun run check green (typecheck, biome, registry validation)
  • Production build passes
  • Browser-verified: zero hydration errors, dock click and keyboard focus semantics, palette arrow-key navigation and Escape, per-variant registry bundles resolve complete file graphs

starc007 added 8 commits June 10, 2026 23:15
- lib/ease.ts becomes the single source for easing curves and spring
  presets (press, swap, layout, mouse-follow); --ease-out in globals.css
  synced to the dominant 0.16,1,0.3,1 curve
- StatefulButton and MagneticButton now compose Button from base.tsx
  instead of carrying inline copies; registry source graph bundles
  imports automatically so installs stay self-contained
- MagneticButton composes the Magnetic wrapper
- useReducedMotion now covers switch, tabs, dock, tilt-card, magnetic,
  command palette, animated number, number ticker, shared layout bg,
  stateful button and the swap action button; CSS media query alone
  cannot stop JS spring transforms
- decorative cursor-follow effects (magnetic, tilt, dock magnification)
  skip touch devices via useHoverCapable to avoid sticky phantom hover
- every inline cubic-bezier replaced with shared EASE_OUT token; swap
  constants re-export from lib/ease; previews, hero and docs migrated
- modal, bottom sheet and token picker share SPRING_PANEL; dock pill
  and hover pills share SPRING_LAYOUT
The cloneElement injection guarded on '__dock' in child props, which is
never true for JSX-created children, so every DockItem fell back to
static defaults (44px, no magnification, Dock size/spring props
ignored). Replace the prop-injection hack with React context.

DockItem is also polymorphic now: onClick renders a real <button> with
focus ring and aria-pressed; without onClick it stays a div wrapper so
items that carry their own link or button keep valid HTML. Focus
bubbles to the wrapper, so keyboard focus magnifies items the same way
hover does.
Drop the cursor-proximity magnification machinery (mouse tracking,
per-item springs, magnification/distance/spring props). Items render at
a fixed size; the gliding active pill and button/div polymorphism stay.
Nav and hero CTAs used the CSS .press utility (120ms symmetric ease-out)
which reads flat next to the spring-pressed buttons in the motion guide.
New PressLink wraps next/link with the same SPRING_PRESS whileTap/
whileHover as the library Button, reduced-motion and touch aware.
button-base, button-stateful and button-magnetic get their own install
slugs like the action-swap variants. The registry import graph bundles
base.tsx and the magnetic wrapper into the variants that need them, so
each command installs a complete working component.
@starc007 starc007 merged commit f33fd70 into main Jun 10, 2026
2 checks passed
@starc007 starc007 deleted the polish/motion-quality branch June 10, 2026 18:15
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