Skip to content

feat(theme): align the spinner recipes with Open Components - #370

Merged
alexgrozav merged 2 commits into
align-component-styles-uxf-487from
spinner-recipes-uxf-499
Oct 29, 2026
Merged

alexgrozav merged 2 commits into
align-component-styles-uxf-487from
spinner-recipes-uxf-499

Conversation

@alexgrozav

@alexgrozav alexgrozav commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

Brings the Spinner recipes in line with the stylesheet rules of the Open Components Spinner page.

  • spinner/em-sized: useSpinnerRecipe, useSpinnerCircleRecipe and useSpinnerTextRecipe gain an em size. The circle is 1em wide and tall, and the container inherits the surrounding font size and sits 0.125em below the baseline, so the spinner matches and centres on the text it sits in. Existing sizes and the md default are unchanged.
  • spinner/current-color: the circle is already drawn in currentColor. A test now pins it.
  • spinner/contrast: each color is checked against what it sits on, in both themes: the page for primary, light and neutral, and the overlay's backdrop for dark. The circle needs 3:1 there, and the label, which takes the spinner's color, 4.5:1. So light switches to @color.white in the dark theme (gray-700 measured 1.58:1 on the page), primary switches to @color.primary-400 (the label measured 3.59:1), and useSpinnerOverlayRecipe's backdrop goes from 50% to 75% black, the modal overlay's value (a white label measured 4.12:1). spinnerContrast.test.ts checks all of it with culori's wcagContrast.
  • spinner/reduced-motion: under &:motion-reduce the circle pulses to 40% and back every 1.6 seconds (@easing.ease-in-out) instead of turning, and the arc stops growing and shrinking. The pulse's duration and iteration count are !important, because the sanitize preset forces every animation to 1ms under reduced motion.
  • spinner/stable-layout: the container and the circle get flex-shrink: 0, and the turn stays a transform.
  • Storybook: the preview hides its <svg> with aria-hidden, renders as a <span> so it can sit in a paragraph or heading, and gets an Em story. The Dark story and the dark row of AllVariants show the spinner on the overlay's backdrop.
  • Docs: the Spinner page gets a rewritten Accessibility section, the em size, the new color values and the darker backdrop.

Related issue

None on GitHub.

Type of change

  • 🐞 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behavior)
  • 📖 Documentation
  • ♻️ Refactor / internal (no functional change)
  • 🔧 Build / tooling / CI

Checklist

  • My commits follow Conventional Commits with a package scope (e.g. feat(theme): …)
  • I ran pnpm build:nodocs && pnpm lint && pnpm typecheck && pnpm test and everything passes
  • I added a changeset (pnpm changeset) for changes to publishable packages, or this change only touches docs/storybook/app/playground/tests
  • I added or updated tests where relevant
  • I updated documentation where relevant
  • I did not edit generated files (dist/, .styleframe/)
  • My PR targets main and stays focused in scope

Notes / screenshots

  • The PR targets the integration branch for the accessibility alignment, not main, so CI runs on the integration PR.
  • Checks ran per package rather than project-wide: pnpm build:nodocs, and in @styleframe/theme the typecheck, all tests and the build; oxfmt --check and oxlint on the touched files; the Storybook build, with axe finding no violations on any of the 13 spinner stories in the light and dark themes; the docs build and test:build.
  • The dark color stays white in both themes, since it's meant for dark surfaces like the overlay's backdrop, where the stories now show it.
  • useSpinnerCircleRecipe now uses the motion-reduce modifier, so it needs the modifier registered first, as useModifiersPreset does.

A spinner should match the text around it, keep showing that something's
happening when people ask for less motion, and stay visible on a dark
page.

The spinner, circle and text recipes gain an em size, 1em wide and tall,
and the spinner no longer shrinks in a flex row. With reduced motion the
circle pulses to 40% and back every 1.6 seconds instead of turning, and
the arc stops growing and shrinking. The pulse's duration and iteration
count are important, because the sanitize preset stops every animation
under reduced motion. The light colour switches to white in the dark
theme, where gray-700 was nearly invisible on the page.

The Storybook spinner hides its svg from assistive technologies, renders
as a span so it can sit in a paragraph or heading, and gets an em story.
The docs page describes what the recipes do for each rule.
@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
styleframe-dev Ready Ready Preview Oct 29, 2026 2:54pm UTC
styleframe-dev-storybook Ready Ready Preview Oct 29, 2026 2:54pm UTC

Request Review

The dark spinner was white on the light page in its stories, and the
label, which takes the spinner's color, fell under 4.5:1 for primary in
the dark theme and for dark on the overlay.

Primary switches to primary-400 in dark mode, and the overlay's backdrop
goes from 50% to 75% black, the modal overlay's value. The stories show
dark on that backdrop, and the contrast test checks the indicator at 3:1
and the label at 4.5:1 there. The pulse uses the ease-in-out easing
token, and the em size sits 0.125em below the baseline so it centres on
the text.
@alexgrozav
alexgrozav merged commit 8b893ab into align-component-styles-uxf-487 Oct 29, 2026
3 checks passed
@alexgrozav
alexgrozav deleted the spinner-recipes-uxf-499 branch October 29, 2026 15:31

This branch was successfully deployed

2 active deployments
Preview – styleframe-dev — 444cd763 Deployed Oct 29, 2026 by vercel[bot]
Preview – styleframe-dev-storybook — 444cd763 Deployed Oct 29, 2026 by vercel[bot]
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