chore(ButtonGroup): migrate to CSS Modules with visual regression baseline#1034
Merged
Conversation
🦋 Changeset detectedLatest commit: be169cb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This was referenced May 15, 2026
The yarn test:visual* scripts were unusable because docker-compose services invoked the same yarn scripts as their container commands, causing infinite recursion (and failing inside the container where docker is not available). The Dockerfile CMD had the same bug. Fixes: - docker-compose.playwright.yml: services now run npx playwright test directly instead of the yarn script. - Dockerfile.playwright: CMD now invokes npx playwright test directly. - .scripts/bash/playwright-docker: forwards extra args to playwright so callers can scope to specific spec files (e.g. yarn test:visual:update tests/buttons/buttongroup.spec.ts). Uses --update-snapshots=all since Playwright 1.50+ requires an explicit mode. - Bump @playwright/test from ^1.57.0 to ^1.60.0 and Dockerfile FROM to v1.60.0-noble so the playwright runtime and browsers match.
e1a4610 to
be169cb
Compare
Contributor
Storybook Preview Deployed✅ Preview URL: https://click-48gjdiy1m-clickhouse.vercel.app Built from commit: |
6 tasks
hoorayimhelping
approved these changes
May 15, 2026
DreaminDani
added a commit
that referenced
this pull request
May 15, 2026
Captures the two-commit, byte-for-byte-snapshot pattern executed in PR #1034 (ButtonGroup) so the same procedure can be applied mechanically to the remaining components in the CSS Modules migration. The skill enforces a hard scope rule: the migration commit is a pure styling refactor — no bundled a11y refinements, type tightening, consumer updates, or CSS correctness fixes. The visual regression tests are credible only because the migration commit changes nothing visible.
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.
Why?
Combines #985 (visual regression tests) and #986 (CSS Modules migration) into a single PR with a clean commit story. This is the first execution of a pattern we want to reuse for the rest of the CSS Modules migration effort: tests-first commit, then like-for-like styling migration where every snapshot from the first commit still passes byte-for-byte.
Supersedes and closes #985 and #986.
How?
Three commits, each doing one thing:
chore(test:visual): fix Docker recursion and bump playwright to 1.60.0— prep. Theyarn test:visual*scripts weren't working locally (docker-compose services invokedyarn test:visualas their command, recursing through the script and failing inside the container wheredockerisn't available). Fixed by having services runnpx playwright testdirectly, forwarding extra args from the shell script, bumping@playwright/testfrom^1.57.0to^1.60.0, and matching the Dockerfile FROM tov1.60.0-noble. Adds--update-snapshots=all(required since Playwright 1.50).test(ButtonGroup): add visual regression baseline before CSS Modules migration— captures the current styled-components rendering as snapshots. 29 Playwright tests covering light + dark themes, type variants, selection, disabled states, layout, multi-select, hover/focus, and keyboard activation. Stories are extended to one per visual variant. Only other source change is a narrow types tightening (HTMLAttributes<HTMLButtonElement>→ButtonHTMLAttributes<HTMLButtonElement>) needed for the newdisabled: trueoption in the test stories to typecheck — pure TypeScript widening, no runtime change.chore(ButtonGroup): migrate styling from styled-components to CSS Modules— pure styling refactor. IntroducesButtonGroup.module.cssand switches the component tocva+cnper the precedent set byButton. Rendered DOM is identical to the previous commit (role="group",role="button",aria-pressed, nativedisabled, prop spread all preserved). All 29 snapshots from commit 2 pass byte-for-byte with zero regenerations — the strongest possible proof that nothing visible changed.classNamepassthrough is preserved viacn(...)on both the wrapper and each option button. Patch bump; the changeset readsmigration of ButtonGroup from styled-components to css modules. no behavior change.A11y refinements that landed in #985/#986 (adding
aria-disabled, removing redundantrole="button", plumbingaria-labelplumbing with JSDoc, the closest-consumeraria-labelinDateTimeRangePicker,:hover:not(:disabled)correctness,:focus-visiblestyling) are deliberately out of scope here — those are real improvements but they're orthogonal to the migration and would muddy the byte-for-byte guarantee. They can be follow-up PRs on top of this.Contribution checklist?
buildcommand runs locallyyarn test:visual tests/buttons/buttongroup.spec.tspasses (29/29, zero snapshot regenerations between commits 2 and 3)yarn test ButtonGrouppasses (15/15)yarn lint:cssandyarn lint:codepass with no new errors