Repository navigation
fix(core): a theme sets the room between a checkbox or a switch and its label - #12455
josephfarina wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
|
Owner decision (engineering owner, covering this pull request): a theme's |
|
/approve-spec 35c0396 |
There was a problem hiding this comment.
Changes requested: one piece of evidence the repository requires for record changes is missing, and the code itself checks out.
- The description has no
## Writing rubric resultssection, which every pull request that changes a knowledge record must report; add one line per rubric item (R1–R7) covering the CheckboxInput FR9 and Switch FR2 edits.
The route works as described: with a theme gap of 3px both rows measure 3px (8px before), the status message keeps its spacing, a hidden label keeps no gap, the new tests fail on the base and pass here, and default rendering is unchanged. Two non-blocking notes: the new row comments in CheckboxInput.tsx and Switch.tsx can keep only the reason (suggestions inline), and FR9 and FR2 cite theme-compilation INV5, which covers guaranteed properties, while calling gap best effort.
Claims and files checked
Review mode: full; reason: no-earlier-review
Claims:
- A theme's gap on the checkbox or switch field target sets the room between the control and its label: verified (3px measured in Chromium; new compiler and source-build tests).
- Before, the gap sat on an inner row no target reached, and the spacing token was the only lever, which also moved the status padding: verified (base row styles read the token; the detached status padding reads the same token).
- The default room stays 8px: verified (token fallback; default stories pixel-identical).
- A hidden label keeps no gap: verified (0px measured under a theme gap).
- The field target holds the row and the status, so a gap there did nothing: verified (the field is a block box; measured).
- RadioList and CheckboxList rows already take a theme gap on their row target: verified (their targets sit on the Item row that carries the gap).
- Each target maps gap to a private variable and drops the raw property: verified (registry entries and compiler test).
- The rows read the variable with the spacing token as fallback: verified (both row styles; source-build test).
- The component docs list the variable and the derived entry: verified (both locales of both docs).
- No public API, prop, default, target or token changes: verified (built API surface shows no change).
- The official themes render as before: verified (the seven official theme stylesheets build byte-identical; default stories pixel-identical).
- The tests cover the gap route, the hidden label and the status padding: verified (the four new route cases fail on the base and pass here).
- The CheckboxInput, Switch and theme test folders pass with 39 files and 2,048 tests: verified (same counts).
- The knowledge, changeset, formatting, lint and type checks pass: verified (lint shows only an existing warning).
- One defect is restored, with no hidden API, visual, default or interaction change: verified.
- Public text carries no internal context: verified.
Files:
.changeset/checkbox-switch-label-gap.md: cleardocs/specs/components/CheckboxInput/CheckboxInput.spec.md: clear content; rubric report missing from the descriptiondocs/specs/components/Switch/Switch.spec.md: clear content; rubric report missing from the descriptionpackages/core/src/CheckboxInput/CheckboxInput.doc.mjs: clearpackages/core/src/CheckboxInput/CheckboxInput.tsx: comment suggestion (non-blocking)packages/core/src/CheckboxInput/labelGap.source-build.test.mjs: clearpackages/core/src/Switch/Switch.doc.mjs: clearpackages/core/src/Switch/Switch.tsx: comment suggestion (non-blocking)packages/core/src/theme/derivedVarRegistry.test.ts: clearpackages/core/src/theme/derivedVarRegistry.ts: clearpackages/core/src/theme/generateThemeRules.test.ts: clear
| // The room between the box and its label. A theme sets it with gap on | ||
| // the `checkbox-input` target, which the compiler hands to this row as | ||
| // --_checkbox-input-gap (derivedVarRegistry): the target is the outer | ||
| // field, which also holds the status message below the row. |
There was a problem hiding this comment.
Non-blocking (INV29): the first sentence restates gap, and the second runs to 35 words across two topics. A shorter version that keeps only the reason:
// The `checkbox-input` target is the outer field, which also holds the
// status message. So a theme's gap reaches this row only through
// --_checkbox-input-gap.| // The room between the switch and its label. A theme sets it with gap on | ||
| // the `switch-field` target, which the compiler hands to this row as | ||
| // --_switch-field-gap (derivedVarRegistry): the target is the outer field, | ||
| // which also holds the status message below the row. |
There was a problem hiding this comment.
Non-blocking (INV29): same as CheckboxInput. A shorter version that keeps only the reason:
// The `switch-field` target is the outer field, which also holds the
// status message. So a theme's gap reaches this row only through
// --_switch-field-gap.|
/approve-spec 59c0580 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, because its admission check stopped the run while CI was full, so the CI jobs need a re-run before merge.
The description now reports the writing rubric results for the CheckboxInput and Switch record edits, which was the one item the earlier review asked for, and the route itself checks out: with a theme gap of 3px both rows measure 3px (8px before), the status message keeps its spacing, a hidden label keeps no gap, the new tests fail on the base and pass here, and default rendering is unchanged. Two earlier notes stay non-blocking: the row comments in CheckboxInput.tsx and Switch.tsx can keep only the reason (suggestions inline), and the two record sentences cite theme-compilation INV5, which covers guaranteed properties, while calling gap best effort.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
Claims:
- The CheckboxInput FR9 and Switch FR2 rows each gain one sentence on the gap route: verified (both record diffs).
- A theme could not set the 8px room between a checkbox or switch and its label: verified (the row reads the spacing token; no target reaches the row).
- The spacing token was the only lever and also moved the status message's padding: verified (the detached status padding and Switch's status margin read the same token).
- The field targets hold the row and the status, so a theme gap there did nothing: verified (the field is a block box; measured 8px between box and label under a 3px theme gap on the base).
- With this change a theme gap on either target changes only the room between the control and its label: verified (3px measured for both; status padding and offset unchanged).
- RadioList and CheckboxList rows already take a theme gap on their row target: verified (their targets sit on the Item row that carries the gap).
- The route goes through a private variable, so the status keeps its spacing and a hidden label keeps no gap, best effort: verified (registry entries, row styles, hidden-label style).
- This is the same pattern Icon uses for width and height: verified (Icon's registry entries route width and height to private variables the same way).
- Each target maps gap to its private variable and drops the raw property on the field: verified (registry entries; compiler test).
- The rows read the variable with the spacing token as fallback: verified (both row styles; source-build test).
- The component docs list the variable and the derived entry: verified (both locales of both docs).
- No public API, prop, default, target or token changes: verified (built API surface shows no change in Core, build or the seven themes).
- The seven official themes render pixel-identical to main: verified (all seven built theme stylesheets are byte-identical, the only Core rule change falls back to the same token, and the default CheckboxInput and Switch stories are pixel-identical).
- The tests cover the gap route, the hidden label and the status padding, and the consistency test covers both docs: verified (the four route cases fail on the base and pass here; the status case and the consistency test pass on both).
- The CheckboxInput, Switch and theme test folders pass with 39 files and 2,048 tests: verified (same counts).
- The knowledge, changeset, formatting, lint and type checks pass: verified (lint shows only an existing warning on an untouched line).
- The writing rubric results R1 to R7 find nothing in the two changed rows: verified (present tense, no research, test-named evidence, no references, no open questions, no project status).
- One defect is restored, with no hidden API, visual, default or interaction change: verified.
- Public text carries no internal context: verified.
- Changeset: a theme sets the room with gap on either target; before, only the spacing token could, which also moved the status padding; the default stays 8px and a hidden label keeps no gap: verified.
Files:
.changeset/checkbox-switch-label-gap.md: cleardocs/specs/components/CheckboxInput/CheckboxInput.spec.md: clear (INV5 citation note, non-blocking)docs/specs/components/Switch/Switch.spec.md: clear (INV5 citation note, non-blocking)packages/core/src/CheckboxInput/CheckboxInput.doc.mjs: clearpackages/core/src/CheckboxInput/CheckboxInput.tsx: comment suggestion (non-blocking)packages/core/src/CheckboxInput/labelGap.source-build.test.mjs: clearpackages/core/src/Switch/Switch.doc.mjs: clearpackages/core/src/Switch/Switch.tsx: comment suggestion (non-blocking)packages/core/src/theme/derivedVarRegistry.test.ts: clearpackages/core/src/theme/derivedVarRegistry.ts: clearpackages/core/src/theme/generateThemeRules.test.ts: clear
- #12072 fix(templates): payment form and checkout wrap the summary below the form on a narrow first paint Author: Joey Farina <[email protected]> - #12274 fix(core): cap the Selector family's trigger-width list minimum at the viewport Author: josephfarina <[email protected]> - #12215 fix(cli): advise keeping one dependency when two packages declare one provider ID Author: Joey <[email protected]> - #12322 [experimental] export --reverse: use the project's own copy of an aliased file, or restore the page's copy with its paths entry Author: josephfarina <[email protected]> - #12403 docs(core): Text's as and PowerSearch's statusVariant list every value their types allow Author: Joey Farina <[email protected]> - #12494 fix(templates): dashboard templates use page sections, not cards, for page regions Author: Joey Farina <[email protected]> - #12282 fix(cli): theme build --check and doctor ignore which CLI release, and which command name, built a theme Author: Joey Farina <[email protected]> - #12420 fix(Chat): ChatToolCalls and ChatDictationButton without a required prop name it and the fix in development Author: Joey Farina <[email protected]> - #12205 fix(cli): equally scored icons put first one whose id the query names in full Author: Joey Farina <[email protected]> - #12455 fix(core): a theme sets the room between a checkbox or a switch and its label Author: josephfarina <[email protected]> - #12658 perf(cli): the first theme build after a CLI upgrade reuses the JavaScript it compiled from a theme's local modules Author: Joey <[email protected]> - #12323 [experimental] export: React logs no render timings while the export draws a page Author: Joey Farina <[email protected]>
|
Landed in #12713. |
Record change:
component:CheckboxInputFR9 andcomponent:SwitchFR2 each gain one sentence (gap on the field target sets the room between the control and its label, routed to the row).Picture check: the seven official themes, light and dark, with and without forced colors, render pixel-identical to main (28 of 28).
User impact
A theme could not set the room between a checkbox or a switch and its label. It is 8px, and a compact or classic look (a native-style 3px) had no way to change it: the gap sits on an inner row that no theming target reaches, and the only lever, the
--spacing-2token, also changes the padding of the status message under the control. With this change a theme writesgapon thecheckbox-inputorswitch-fieldtarget, for examplecomponents: {'checkbox-input': {base: {gap: '3px'}}}, and only the room between the control and its label changes.Problem and solution fit
checkbox-inputandswitch-fieldtargets are the outer field, which holds the row (control and label) and the status message below it; the row with the gap has no target.gapon the field gets nothing (the field is no flex row), and the token route moves the status box too.Expected behavior and authority
component:CheckboxInputFR9 andcomponent:SwitchFR2 each gain one sentence:gapon the field target sets the room between the control and its label; the compiler routes it to the row through a private variable (architecture:theme-compilationINV5), so the status message keeps its own spacing; with the label hidden the row keeps no gap; best effort underarchitecture:component-theming-surfaceINV9. This is the pattern Icon uses forwidthandheight.Smallest restoration
derivedVarRegistry:checkbox-inputandswitch-fieldmapgapto--_checkbox-input-gapand--_switch-field-gap, replacing the raw property on the field.CheckboxInputandSwitch: the row's gap reads that variable, falling back to--spacing-2.Evidence
gap: 3pxon both targets: the room between the box and its label, and between the switch and its label, is 3px (8px before); the status message's padding stays 8px.generateThemeRules.test.tschecks each target'sgapbecomes its variable with no rawgapon the field;labelGap.source-build.test.mjscompiles CheckboxInput, Switch and FieldStatus and checks the row gap reads the variable with the--spacing-2fallback, a hidden label keeps 0, and the status padding does not read it. The derived-variable consistency test covers both docs.Writing rubric results
Covers the CheckboxInput FR9 and Switch FR2 sentences and their evidence rows.
Scope
Components: CheckboxInput, Switch
Testing
vitest run packages/core/src/CheckboxInput packages/core/src/Switch packages/core/src/theme: 39 files, 2,048 tests pass.pnpm check:knowledge,pnpm check:changesets, Prettier, ESLint andtsc --noEmitfor Core pass.