Repository navigation
fix(Switch): the thumb rests as far from the track's end as from its top and bottom - #12589
josephfarina wants to merge 8 commits into
Conversation
…top and bottom, from the track's and thumb's sizes
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
Look check against main: the seven official themes show nothing new (one existing problem fixed in matcha); the only moved pixels are the small off thumb with a mouse and the forced-colors on thumb, each by 1px, as described. |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Switch · Storybook | 109.4 kB (−5 B) · 10.1 kB CSS (+97 B) | 1,736 (+3) | — · — · — |
Package size: @astryxdesign/core 7.66 MB packed (+1.5 kB); no new dependencies.
Wide change (shared styles: packages/core/src/theme/derivedVarRegistry.ts): add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
|
Owner decision (engineering owner, covering this pull request): the Switch thumb's spacing is derived from the track and thumb sizes through two private variables, so a theme that resizes the switch keeps the thumb resting at both ends for both pointer types with no per-part work. The new units are an approved fallback tier, the switch is tested right to left, containment keeps the 40×24 track, and reduced motion is unchanged. The changeset names the two one-pixel moves. The Switch record's FR13 and FR14 each gain one sentence that states this. |
|
/approve-spec 09dee72 |
There was a problem hiding this comment.
Changes requested. The rest rule itself holds in every state measured (both sizes, both pointers, both directions, forced colors, and a theme-sized thumb), so two fixes remain:
- Failing test: the new
SwitchThumbRest.interaction.browser.spec.tsfails all 8 theme-resized cases in Chromium at line 108 because the track renders 40 × 31, not 51 × 31: the switch wrapper keeps its fixed 40 × 24 box (Switch.tsx:112-121), so a theme'swidthonswitchnever widens the track; either let the wrapper follow the track's size or scope the test, the changeset and the description to the thumb size and the track height. - Release note: the changeset's "Two states move 1px … Everything else draws the same pixels" is not accurate under forced colors, where the medium off thumb with a mouse (5 → 4px from the start) and all four thumbs under a finger (1px toward their end) move too, so the note should name those moves.
Non-blocking: a theme padding on switch now moves the thumb under a finger (with 3px the on thumb runs 1px past the end), and Switch.test.tsx:1421 names SwitchThumbTravel where the file is SwitchThumbRest.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim, changeset: the thumb rests as far from the end as from the top and bottom, both pointers, from the track's and thumb's sizes: verified by measurement for shipped sizes, a theme-sized thumb and track height.
- Claim, changeset and description: a theme that sizes the track with
widthandheightonswitchkeeps the thumb at the ends: false forwidth, which never renders (the track stays 40px wide). - Claim, changeset: before, a resized thumb stopped short or ran past the end, and under a finger jumped at release: verified (a 27px on thumb sat 5px past the end with a mouse; the fixed touch insets differ from the touch presentation's computed rest).
- Claim, changeset and description: only two states move 1px (small off thumb with a mouse; forced-colors on thumb) and everything else is unchanged: false under forced colors (five more states move 1px).
- Claim, description: with a mouse the base on thumb moves a fixed 12 or 14px, and under a finger it rests at fixed 2 to 4px insets: verified in the base source.
- Claim, description: the size container leaves the track's box at 40 × 24: verified (the browser spec's shipped-box cases pass).
- Claim, description: track padding cancels out with a mouse: verified; under a finger a theme padding still moves the rest (non-blocking).
- Claim, description: container query units are within the supported browsers: verified, Core already uses them (Slider, Layout).
- Claim, description: no public prop, default, target or token changes: verified, the built API surfaces of Core and the seven themes are identical.
- Claim, description: the browser spec proves a theme-sized thumb rests at each end: false, its 8 theme-sized cases fail.
- Claim, description: the derived-variable consistency test covers the new entry, and reduced motion is unchanged: verified.
- Claim, description: the unit run passes 9 files and 1,154 tests, and the knowledge check passes: verified.
- File
.changeset/switch-thumb-rest-from-sizes.md: release note understates the forced-colors moves and the track-width case. - File
docs/specs/components/Switch/Switch.spec.md: clear; the new FR13 and FR14 sentences carry the exact-head spec approval. - File
packages/core/src/Switch/Switch.doc.mjs: clear; both variables are private and match the registry. - File
packages/core/src/Switch/Switch.test.tsx: clear apart from the stale spec name at line 1421. - File
packages/core/src/Switch/Switch.tsx: clear for the shipped sizes; theme padding under a finger is a non-blocking note. - File
packages/core/src/Switch/__tests__/SwitchThumbRest.interaction.browser.spec.ts: 8 of 12 cases fail at line 108. - File
packages/core/src/theme/derivedVarRegistry.ts: clear. - File
packages/core/src/theme/derivedVarRegistry.test.ts: clear.
| width: 40, | ||
| height: 24, | ||
| padding: 4, | ||
| padding: {default: 4, [TOUCH]: 0}, |
There was a problem hiding this comment.
Non-blocking: a theme's padding on switch lands in the theme layer, which outranks this 0, so under a finger 50cqb reads a smaller content box while the insets still measure from the padding box. With 3px the off thumb sits 1px from the start and the on thumb runs 1px past the end (base: 4 and 2), and the touch presentation's measured rest no longer matches. Padding is best effort on this target, so a note only.
|
/approve-spec 8160317 |
…n input covers it
|
/approve-spec 552296f |
There was a problem hiding this comment.
Changes requested: one release-note correction remains. A theme-sized track now renders at its own size and the new rest test passes, so the earlier track-width finding is resolved.
- The changeset and the description say only two states move 1px and everything else draws the same pixels, but under forced colors five more thumbs move 1px toward their end: the medium off thumb with a mouse, and the small and medium off and on thumbs under a finger (suggested: "In forced colors every thumb moves up to 1px toward its end, so it sits as far from the end as from the top.").
Non-blocking: a theme's padding on switch still shifts the rest under a finger, Switch.test.tsx:1421 still names SwitchThumbTravel, and two new comments in Switch.tsx read better as short sentences.
Claims and files checked
Review mode: full; reason: spec-record
Claims (changeset):
- The thumb rests as far from the track's end as from its top and bottom, from the track's and thumb's sizes: verified (measured in every size, state, pointer and direction; the new browser test passes in CI).
- A theme that sizes the track or the thumb keeps the thumb at the ends, where before it ran past or stopped short: verified (a 51 × 31 track with a 27px thumb: on thumb 5px past the end on main, 2px from it here).
- The control's box follows the track, where before it squeezed a wider track: verified (40px wide on main, 51px here).
- The small off thumb with a mouse moves from 2px to 3px, and the forced-colors on thumb with a mouse from 1px to 2px: verified.
- Everything else draws the same pixels in every official theme: false (five more forced-colors thumbs move 1px).
Claims (description):
- The Switch record's two requirements each gain one sentence: partly false (the rest requirement gains two sentences; their content matches).
- The seven themes, light and dark, both directions, both pointers render identically apart from the two 1px moves: false under forced colors; verified otherwise (every theme's built stylesheet is unchanged).
- On main the mouse travel is a fixed 12 or 14px and the touch insets a fixed 2 to 4px, while the touch presentation measures the rendered boxes: verified (
Switch.tsxbase styles,useSwitchTouch.ts:398-425). - The control's box takes no size of its own and is the same box at the shipped sizes: verified (
Switch.tsx:289-298; 40 × 24 and 32 × 20 measured). - The track is a size container with an explicit size, so its own box is unchanged: verified (
Switch.tsx:348). - With a mouse the place comes from container units and the track's padding cancels out: verified (
Switch.tsx:143-144). - Under a finger the track has no padding and the rest reads the thumb-size variable: verified (
Switch.tsx:118-139); a theme's own padding still overrides it (non-blocking). - Container query units are within the supported browsers: verified (they are in the full-support browser tier).
- No public prop, default, target or token changes: verified (built API surfaces identical).
- A theme-sized 51 × 31 track with a 27px thumb gets 2px gaps at every edge, both pointers, both directions: verified.
- The unit tests read the size variables and the travel formula with its right-to-left mirror: verified (
Switch.test.tsx:1064-1076,:1404-1422). - The new browser test covers both pointers and directions, the shipped box, the theme-sized rests and the input covering the control: verified; it passes in CI.
- The derived-variable consistency test covers the new entry: verified (
derivedVarRegistry.test.ts:303). - Reduced motion is unchanged: verified (no transition rule changes).
- The writing rubric finds nothing: verified.
- The listed unit tests and the knowledge check pass: verified (1,154 tests).
Files:
.changeset/switch-thumb-rest-from-sizes.md: finding (forced-colors claim).docs/specs/components/Switch/Switch.spec.md: clear.packages/core/src/Switch/Switch.doc.mjs: clear.packages/core/src/Switch/Switch.test.tsx: non-blocking (stale test name at line 1421).packages/core/src/Switch/Switch.tsx: non-blocking (theme padding under a finger; comment wording at lines 115-117 and 289-291).packages/core/src/Switch/__tests__/SwitchThumbRest.interaction.browser.spec.ts: clear.packages/core/src/theme/derivedVarRegistry.test.ts: clear.packages/core/src/theme/derivedVarRegistry.ts: clear.
| // The control's box is the track's: it takes no size of its own, so a | ||
| // theme that sizes the track (`width` and `height` on `switch`) sizes the | ||
| // box the invisible input covers and the row it sits in. |
There was a problem hiding this comment.
Non-blocking (comment style): this is one 37-word sentence. Suggested: "The control's box is the track's box. So a theme that sizes the track also sizes the input's box and the row."
|
/approve-spec 98bb80b |
There was a problem hiding this comment.
Approved pending CI: several CI jobs are still running on this head. The release note and the description now name every forced-colors thumb move, which resolves the earlier finding, and no blocking finding remains.
Non-blocking: a theme's padding on switch still shifts the rest under a finger, and two comments in Switch.tsx read better as short sentences (see the earlier inline notes).
Claims and files checked
Review mode: incremental; reason: none
Claims (changeset):
- The thumb rests as far from the track's end as from its top and bottom, with either pointer, from the track's and the thumb's sizes: verified (measured in both sizes, both states, both pointers, both directions and forced colors; the new browser test passes in CI).
- A theme that sizes the track or the thumb keeps the thumb at the ends, where before it stopped short, ran past or jumped at release: verified (a 51 × 31 track with a 27px thumb: the on thumb sits 5px past the end on main, 2px from it here).
- The control's box follows the track, where before it squeezed a wider track to the shipped size: verified (40px wide on main, 51px here).
- The small off thumb with a mouse moves from 2px to 3px, and in forced colors every thumb moves up to 1px toward its end: verified (seven forced-colors states move 1px; the small off thumb with a mouse stays at 3px).
- Everything else draws the same pixels in every official theme: verified (every other shipped state is pixel-identical, and no official theme sizes or pads the switch).
Claims (description):
- The Switch record's thumb requirement gains one sentence and its rest requirement two: verified.
- The seven official themes, light and dark, in both directions and with both pointers render identically apart from the named moves: verified (the themes only recolour the switch; every theme's built stylesheet is unchanged).
- On main the mouse travel is a fixed 12 or 14px and the touch insets a fixed 2 to 4px, while the touch presentation measures the rendered boxes: verified (base styles;
useSwitchTouch.ts:398-424). - With the change the thumb rests as far from each end as from its top and bottom, with either pointer and in either direction: verified (measured).
- The old constants were tuned to the shipped 32 × 20 and 40 × 24 tracks: verified.
- The rule matches the touch presentation's inset and travel formulas: verified (
switchTouch.ts:64,:83). - The control's box takes no size of its own and is the same box at the shipped sizes: verified (
Switch.tsx:289-298; 40 × 24 and 32 × 20 measured). - The track is a size container with an explicit size, so its own box is unchanged: verified (
Switch.tsx:348). - With a mouse the place comes from container units, mirrored in right to left, and the track's padding cancels out: verified (
Switch.tsx:143-144). - Under a finger the track has no padding and the rest reads the thumb-size variable: verified (
Switch.tsx:118-139); a theme's own padding still overrides it (non-blocking). - Container query units are within the supported browsers: verified.
- No public prop, default, target or token changes: verified (built API surfaces identical).
- The small off thumb with a mouse now sits at 3px, as under a finger: verified.
- In forced colors the on thumb and the medium off thumb with a mouse, and the small and medium thumbs under a finger, each move up to 1px toward their end: verified (measured).
- Screenshots outside forced colors are identical apart from the small off thumb: verified.
- A 51 × 31 track with a 27px thumb renders 51px wide (40px on main) with 2px gaps at every edge, both pointers, both directions: verified.
- The unit tests read the size variables and the travel formula with its right-to-left mirror: verified (
Switch.test.tsx:1064-1076,:1404-1423). - The new browser test covers both pointers and directions, the shipped box, the theme-sized rests and the input covering the control: verified; it passes in CI.
- The derived-variable consistency test covers the new entry: verified (
derivedVarRegistry.test.ts:303). - Reduced motion is unchanged: verified (no transition rule changes).
- The writing rubric finds nothing: verified.
- The listed unit tests, knowledge and changeset checks, lint and typecheck pass: verified (1,154 tests locally; lint and typecheck pass in CI).
Files:
.changeset/switch-thumb-rest-from-sizes.md: clear.docs/specs/components/Switch/Switch.spec.md: clear.packages/core/src/Switch/Switch.doc.mjs: clear.packages/core/src/Switch/Switch.test.tsx: clear.packages/core/src/Switch/Switch.tsx: non-blocking (theme padding under a finger; comment wording at lines 115-117 and 289-291).packages/core/src/Switch/__tests__/SwitchThumbRest.interaction.browser.spec.ts: clear.packages/core/src/theme/derivedVarRegistry.test.ts: clear.packages/core/src/theme/derivedVarRegistry.ts: clear.
The switch doc now names two derived routes (the field's gap from main, the thumb's size here); the registry consistency test maps Switch to both targets. [skip ci]
…he theme's size for the state it attached in; the release note names each forced-colors move; a theme's padding is best effort [skip ci]
|
/approve-spec 5bdbb58 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet.
The thumb now rests as far from the track's end as from its top and bottom, from the rendered track and thumb sizes, with a mouse or a finger and in either direction; a theme-sized 51 × 31 track with a 27px thumb measures 2px on every side, and the first value change under a finger keeps a theme-sized thumb at its size. No blocking findings remain.
- Non-blocking: the theme thumb size read when the touch presentation attaches (
useSwitchTouch.ts:313) is kept after asizechange, so a change before the next press can start from the wrong circle; clearing it insetGeometrykeeps the fix exact.
Claims and files checked
Review mode: full; reason: spec-record
- Release note: the thumb rests as far from the end as from the top and bottom with either pointer, from the track's and thumb's sizes: verified in Chromium across both sizes, both states, both pointers, right to left and forced colors.
- Release note: a theme that sizes the track or thumb keeps the thumb at the ends, where it used to stop short, run past the end, or jump at release: verified (before, 4px short and 5px past the end; after, 2px at each end).
- Release note: the control's box follows the track instead of squeezing it to 32 × 20 or 40 × 24: verified (40 → 51px wide; the hidden input covers it).
- Release note: the small off thumb with a mouse moves from 2px to 3px: verified.
- Release note: in forced colors each thumb moves up to 1px as described: verified state by state.
- Release note: everything else draws the same pixels in every official theme: verified (no official theme sizes the switch; built theme CSS is identical; unchanged states are pixel-identical).
- Description: the record's FR13 gains one sentence and FR14 two, with a best-effort note for padding: verified.
- Description: fixed travel and insets tuned to the shipped tracks caused the defect: verified in the base code.
- Description: the control box takes no size of its own, the track is a size container with its box unchanged, and the mouse and finger formulas are as stated, mirrored right to left: verified in code and in the browser.
- Description: container query units are within the supported browser tiers: verified against the browser-support doc.
- Description: no public prop, default, target or token changes: verified (API surface comparison: 0 rows).
- Description: a theme-sized 51 × 31 track with a 27px thumb sits 2px from every edge with a mouse, a finger and right to left: verified.
- Description: the unit, browser and registry tests cover the variables, the travel formula, the right-to-left mirror, the shipped box and the widened control: verified by reading the tests.
- Description: reduced motion is unchanged: verified (no transition or reduced-motion code changed).
- Description: the first value change before any press now starts from the theme's thumb size, and its new test fails without the fix: verified (two of the three new tests fail on the base; in the browser the base thumb drops to 16px and grows back, the head stays at 27px).
- Description: the listed test, knowledge, changeset, probe-theme, Prettier, ESLint and type checks pass: verified; the two test counts are now 1,172 and 2,112 after the latest merge.
- Description: the Switch browser specs pass on a local Storybook: not rerun here; CI has not run them at this head.
- Files:
.changeset/switch-thumb-rest-from-sizes.mdclear;docs/specs/components/Switch/Switch.spec.mdclear;packages/core/src/Switch/Switch.doc.mjsclear;packages/core/src/Switch/Switch.test.tsxclear;packages/core/src/Switch/Switch.tsxnon-blocking comment style;packages/core/src/Switch/__tests__/SwitchThumbRest.interaction.browser.spec.tsclear;packages/core/src/Switch/useSwitchTouch.test.tsclear;packages/core/src/Switch/useSwitchTouch.tsnon-blocking note;packages/core/src/theme/derivedVarRegistry.test.tsclear;packages/core/src/theme/derivedVarRegistry.tsclear.
| '--_switch-thumb-width', | ||
| ), | ||
| ); | ||
| this.attachedThumb = themed ? Number(themed[1]) : null; |
There was a problem hiding this comment.
Non-blocking: this reads the theme size for the state and size the switch attached in, but setGeometry (:419-423) clears the measurement on a size change and keeps this value, so a key or value change before the next press then takes the attach-time circle as the previous one (with a theme that sizes only the on thumb, the thumb jumps to its new size instead of growing). Clearing attachedThumb in setGeometry, and using it only when previous is the state it was read in, keeps the first-change fix exact. Only px values parse here, so a thumb sized in rem still falls back to the default.
|
/approve-spec be8f302 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet.
The thumb now rests as far from the track's end as from its top and bottom, from the rendered track and thumb sizes, with a mouse or a finger and in either direction; a theme-sized 51 × 31 track with a 27px thumb measures 2px on every side, and the shipped sizes keep their rests apart from the 1px moves the release note names. No blocking findings remain.
- Non-blocking: the theme thumb size read when the touch presentation attaches (
useSwitchTouch.ts:313) is kept after asizechange, so a change before the next press can start from the wrong circle; clearing it insetGeometrykeeps the fix exact.
Claims and files checked
Review mode: full; reason: merge-touches-pr-files
- Release note: the thumb rests as far from the end as from the top and bottom at both ends, with a mouse and a finger, from the track's and thumb's sizes: verified in Chromium for both sizes, both states, both pointers, right to left and forced colors.
- Release note: a theme that sizes the track or the thumb keeps the thumb at the ends, where it used to stop short, run past the end, or jump at release: verified (before, 4px from the start against 2px at the top, and 5px past the end; after, 2px at each end); the release jump follows from the old fixed inset against the measured one.
- Release note: the control's box follows the track instead of squeezing it to 32 × 20 or 40 × 24: verified (40 → 51px wide; the hidden input covers it).
- Release note: the small off thumb with a mouse moves from 2px to 3px: verified, in both directions.
- Release note: in forced colors each thumb moves up to 1px so it sits as far from its end as from the top: verified in the states measured (medium off with a mouse 5 → 4px, on with a mouse 1 → 2px, medium on with a finger 3 → 2px) and by the rest arithmetic for the others.
- Release note: everything else draws the same pixels in every official theme: verified (no official theme sizes the switch, every built theme stylesheet is identical, and the unchanged states compare pixel-identical).
- Description: the record's FR13 gains one sentence and FR14 two, with a best-effort note for padding: verified.
- Description: fixed travel and insets tuned to the shipped tracks cause the defect, while the touch presentation computes its travel from the measured boxes: verified in the base code.
- Description: the control box takes no size of its own, the track is a size container whose box stays as shipped, and the mouse and finger formulas are as stated, mirrored right to left: verified in code and in the browser.
- Description: container query units are within the supported browser tiers: verified against the browser-support guide.
- Description: no public prop, default, target or token changes: verified (API surface comparison: 0 rows).
- Description: a theme-sized 51 × 31 track with a 27px thumb sits 2px from every edge with a mouse, a finger and right to left: verified.
- Description: the unit, browser and registry tests cover the variables, the travel formula, the right-to-left mirror, the shipped box and the widened control: verified by reading them; the new browser spec passes its 12 Chromium cases here.
- Description: reduced motion is unchanged: verified (no transition or reduced-motion code changed).
- Description: the first value change before any press now starts from the theme's thumb size, and its new test fails without the fix: verified (two of the three new tests fail on the base and pass on the head).
- Description: the listed unit-test, knowledge, changeset, probe-theme, Prettier, ESLint and type checks pass: verified; after the latest merge the two test runs count 1,183 and 2,153 tests.
- Description: the picture check, look check and preflight reports: not reproduced here; the browser comparison and identical built theme stylesheets cover what they report.
- Files:
.changeset/switch-thumb-rest-from-sizes.mdclear;docs/specs/components/Switch/Switch.spec.mdclear;packages/core/src/Switch/Switch.doc.mjsclear;packages/core/src/Switch/Switch.test.tsxclear;packages/core/src/Switch/Switch.tsxnon-blocking comment style;packages/core/src/Switch/__tests__/SwitchThumbRest.interaction.browser.spec.tsclear;packages/core/src/Switch/useSwitchTouch.test.tsclear;packages/core/src/Switch/useSwitchTouch.tsnon-blocking note;packages/core/src/theme/derivedVarRegistry.test.tsclear;packages/core/src/theme/derivedVarRegistry.tsclear.
- #12709 fix(table): a children-mode table scrolls instead of breaking words Author: @josephfarina - #12589 fix(Switch): the thumb rests as far from the track's end as from its top and bottom Author: @josephfarina
|
Landed in #12908. |
Record change:
component:SwitchFR13 gains one sentence and FR14 two (plus a best-effort note for a theme's padding) (the thumb's size reads two private variables thatwidthandheightonswitch-thumbset; at rest it sits as far from the track's end as from its top and bottom, at both ends, from the track's and the thumb's sizes; the control's box is the track's).Picture check: the seven official themes, light and dark, left to right and right to left, render pixel-identical with a mouse and under a finger (28 of 28 each), except the 1px moves named below; the look check against main finds nothing new in any of the seven.
look gate v1.16 light+dark at 5bdbb58's diff on the drain head 3aeeef5: six of seven official themes clean (neutral: 1 fixed); y2k shows one low-confidence judge note about its dark switch tracks, whose fills are identical on base and PR (sent to forensics).
User impact
A theme that sizes the switch (
widthandheightonswitch, or onswitch-thumb) gets a thumb that does not reach the ends: with a mouse the on thumb travels a fixed 12 or 14px, so in a wider track it stops short and in a narrower one it runs past the end; under a finger it rests at fixed 2 to 4px insets while the touch presentation computes its travel from the measured track and thumb, so the thumb jumps when the finger lifts. With this change the thumb rests as far from the track's end as from its top and bottom, at both ends, read from the track's and the thumb's own sizes, with either pointer and in either writing direction.Problem and solution fit
Expected behavior and authority
component:SwitchFR13 and FR14: the thumb's size reads--_switch-thumb-widthand--_switch-thumb-height, private variables thatwidthandheightonswitch-thumbset through the derived-variable registry (architecture:theme-compilationINV5), else the state's own size; at rest, under any pointer and in either writing direction, the thumb sits as far from the track's end as from its top and bottom, at both ends. This matches what the touch presentation already computes (inset = (trackHeight − thumbHeight) / 2,travel = trackWidth − thumbWidth − 2 × inset).Smallest restoration
container-type: size); it has an explicit width and height, so its own box is unchanged.translateX(calc(50cqb - 50%))off andtranslateX(calc(100cqi - 50cqb - 50%))on, mirrored under right to left. An even padding cancels out with a mouse; a theme's padding onswitchstill moves the rest under a finger, and an uneven one with a mouse (best effort, as FR14 says).calc(50cqb - thumb width / 2)from its end, reading the same thumb-size variable.Two states move 1px to follow the one rule, both of them existing inconsistencies:
Evidence
SwitchThumbRest.interaction.browser.spec.tschecks, with both pointers and in both directions, that the track keeps its shipped 40 by 24 box and that a theme-sized thumb rests at each end as far from it as from the top and bottom, and that a theme-widened track widens the control's box with the hidden input covering all of it. The derived-variable consistency test covers the new registry entry.Writing rubric results
Scope
Components: Switch
Testing
preflight: review clean at 5bdbb58 (no blocking findings; the record sentences await
/approve-spec).A merge of main brought main's first-press track measuring (perf(Switch): measure the track at the first press, not at mount #12700); its first value change before any press took the previous thumb size from Core's defaults, which would shrink a theme-sized thumb and grow it back. The previous circle now comes from the theme's thumb size for the state the switch attached in (
--_switch-thumb-width, read as a style when the touch presentation attaches, never a layout), else the default (useSwitchTouch.ts; tests: a 27px thumb in a 51 × 31 track, a uniform 20px thumb, a thumb sized only when on).vitest run packages/core/src/Switch packages/core/src/theme/derivedVarRegistry.test.ts packages/core/src/theme/themingTargets.test.ts packages/core/src/theme/generateThemeRules.test.ts: 9 files, 1,154 tests pass.pnpm check:knowledge,pnpm check:changesets,pnpm visual:probe-theme:check, Prettier, ESLint andtsc --noEmitfor Core pass.The Switch browser specs run on a locally built Storybook (Chromium): 73 pass,
SwitchThumbRest12/12.vitest run packages/core/src/Switch packages/core/src/theme packages/core/src/CheckboxInput: 46 files, 2,110 tests pass; the new first-change test fails without its fix.