Repository navigation
feat(theme): align the spinner recipes with Open Components - #370
Merged
alexgrozav merged 2 commits intoOct 29, 2026
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
7 of 13 tasks
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Brings the Spinner recipes in line with the stylesheet rules of the Open Components Spinner page.
spinner/em-sized:useSpinnerRecipe,useSpinnerCircleRecipeanduseSpinnerTextRecipegain anemsize. The circle is1emwide and tall, and the container inherits the surrounding font size and sits0.125embelow the baseline, so the spinner matches and centres on the text it sits in. Existing sizes and themddefault are unchanged.spinner/current-color: the circle is already drawn incurrentColor. A test now pins it.spinner/contrast: each color is checked against what it sits on, in both themes: the page forprimary,lightandneutral, and the overlay's backdrop fordark. The circle needs 3:1 there, and the label, which takes the spinner's color, 4.5:1. Solightswitches to@color.whitein the dark theme (gray-700measured 1.58:1 on the page),primaryswitches to@color.primary-400(the label measured 3.59:1), anduseSpinnerOverlayRecipe's backdrop goes from 50% to 75% black, the modal overlay's value (a white label measured 4.12:1).spinnerContrast.test.tschecks all of it withculori'swcagContrast.spinner/reduced-motion: under&:motion-reducethe 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 to1msunder reduced motion.spinner/stable-layout: the container and the circle getflex-shrink: 0, and the turn stays atransform.<svg>witharia-hidden, renders as a<span>so it can sit in a paragraph or heading, and gets anEmstory. TheDarkstory and thedarkrow ofAllVariantsshow the spinner on the overlay's backdrop.emsize, the new color values and the darker backdrop.Related issue
None on GitHub.
Type of change
Checklist
feat(theme): …)pnpm build:nodocs && pnpm lint && pnpm typecheck && pnpm testand everything passespnpm changeset) for changes to publishable packages, or this change only touches docs/storybook/app/playground/testsdist/,.styleframe/)mainand stays focused in scopeNotes / screenshots
main, so CI runs on the integration PR.pnpm build:nodocs, and in@styleframe/themethe typecheck, all tests and the build;oxfmt --checkandoxlinton 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 andtest:build.darkcolor stays white in both themes, since it's meant for dark surfaces like the overlay's backdrop, where the stories now show it.useSpinnerCircleRecipenow uses themotion-reducemodifier, so it needs the modifier registered first, asuseModifiersPresetdoes.