Repository navigation
fix(cli): a focus outline the resting scope sets itself is not overwritten by a wider one - #13390
josephfarina wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
…itten by a wider one Review findings on #13357: with a ghost focus outline, a small-ghost focus outline-color and a resting outline none for small ghosts, the wider outline was copied over the small ghost's own color (and a dark-only whole-part color over it in dark mode); and a focus color set for a combined state (focus-visible+active) was copied to the plain focus state. A wider value is now copied only for the plain focus state, and only where the resting scope sets no focus outline of its own in that mode.
3bdabd0 to
529d704
Compare
|
/approve-spec 529d704 |
There was a problem hiding this comment.
Changes requested. An engineering owner's /approve-spec for this head settles the direction: a focus outline the resting scope sets itself is not replaced by a wider one. Three things still need fixing:
- When the resting scope sets any focus outline property,
withFocusOutlinenow skips every wider value (packages/cli/api/theme-edit/_settings.mjs:7225-7229), so in the description's own case (ghost focusoutline 2px solid #000000, small-ghost focusoutline-color #00aa00,outline none --when variant:ghost+size:sm) small ghost buttons getoutline-style: noneand show no keyboard focus ring, and a small-ghostoutline-offsetoroutline-stylealone loses the ghost's ring or its colour. - The new state filter (
_settings.mjs:7217) changes nothing for combined states, which the CLI stores asactive+focus-visibleand which never reached the copy, but it drops a wider--state focuscolour, so with a ghostoutline-color #ff0000 --state focussmall ghost buttons now ring in their text colour instead of red. - The changeset and description say the resting scope's own focus outline "stays as set" and that combined-state values are no longer copied, but in the first case no ring is drawn and the second already held before this change.
Copying a wider value only for the longhands the resting scope does not set (writing a wider outline as its style, width and colour longhands), and testing the applied outline rather than the declarations, would cover the first point.
Claims and files checked
Review mode: full; reason: no-earlier-review
Release note claims:
- A focus outline set for a variant and a size stays as set under a resting
outlinefor that scope: false; the colour declaration stays, but the ring is not drawn (outline-style: nonein the compiled theme) (finding). - A wider focus outline (one variant's, or one mode's) is no longer copied over it: verified (no ghost outline and no dark-only red in the small ghost's focus rules).
- A focus outline set for a combined state is never copied to the plain focus state: holds, but already held before this change (finding).
- The note is an experimental patch for the CLI: verified.
Description claims:
- Before, small ghost buttons got the ghost's black ring instead of their own green, and a dark-only whole-part red in dark mode: verified on the base.
- A wider focus outline is now copied only where the resting scope sets no focus outline of its own, so the small ghost's own green stays: the copy rule is verified; the green ring is false, no ring is drawn (finding).
- A combined-state focus outline is no longer copied to the small ghost's plain focus: false as a change, the base did not copy it either (finding).
- The new case fails on the base pull request's head: verified for the own-colour case; the combined-state case passes there.
- The whole theme-edit suite gives the same results as its base: partly verified; the 56 theme-edit test files that set outline or focus states match apart from the two new tests.
- One defect is restored with no new public API, default or interaction model, and no internal context: no new API, default or internal context is verified; the restoration loses the focus ring (finding).
Files:
.changeset/experimental-theme-rest-look-own-scope-focus.md: claims outcomes the change does not produce (finding).packages/cli/api/theme-edit/_settings.mjs: the per-setting skip loses the focus ring, and the state filter drops--state focusvalues (findings).packages/cli/api/theme-edit/theme-rest-look-keeps-hover-and-focus.test.mjs: the new cases check declarations rather than the applied outline, and the combined-state case passes on the base (covered by the findings).
… what the resting scope sets Review findings on #13390: skipping every wider value when the resting scope set any focus outline property left small ghosts with no ring (outline-style none), and the plain-state filter dropped a wider --state focus color. A wider outline is now copied as its style, width and color longhands, each skipped only where the resting scope sets that longhand (or the shorthand) itself; the state filter is gone.
|
/approve-spec b5885d1 |
There was a problem hiding this comment.
Changes requested. An engineering owner's /approve-spec for this head settles the direction (a wider focus outline is copied to the resting scope per longhand, keeping what that scope sets itself), and one defect needs a fix:
longhandsinpackages/cli/api/theme-edit/_settings.mjs(lines 7224-7234) treats any width its regex does not match as part of the colour, so with a ghost focusoutline var(--focus-outline-width) solid #ff0000(or acalc()width) andoutline none --when variant:ghost+size:smit writesoutline-color: var(--focus-outline-width) #ff0000and no width, and small ghost buttons focus with a 3px ring in the text colour instead of the theme's red 2px ring.
Reading each word against the property grammar (matchValue in _css.mjs reads calc(), min(), max() and clamp() as widths), copying the shorthand as written when a word is a var(), and adding a var(--focus-outline-width) test case would cover it; the three earlier findings are fixed.
Claims and files checked
Review mode: incremental; reason: none
Release note claims:
- Under a resting outline for a variant and a size, a focus outline property the theme sets for that scope stays as set: verified (the small ghost keeps its own green in light and dark, in the browser).
- The wider outline's other properties still come, so the ring shows in the scope's own colour: verified for a literal width; it does not hold for a
var()orcalc()width (the blocking finding). - An experimental patch for the CLI: verified.
Description claims:
- Before, small ghost buttons got the ghost's black ring instead of their own green, and a dark-only whole-part red in dark mode: verified on the base.
- A wider focus outline is now copied per longhand, each skipped only where the resting scope sets that longhand itself, in every mode or the wider value's mode: verified in the code; the skip also covers the scope's own
outlineshorthand. - The small ghost keeps its green, gets the ghost's solid 2px ring, and the dark-only red is not copied over it: verified in light and dark.
- A wider colour set for the plain focus state still reaches the small ghost: verified.
- The test file adds the green-with-ring and plain-focus cases and restates earlier cases as longhands: verified; three of its cases fail on the base and the plain-focus case passes there.
- The theme-edit suite gives the same results as its base: partly verified; the 90 theme-edit test files that mention outline or focus pass on both, the head adding its two new tests.
- The change sits directly on the pull request it fixes: verified.
- No new public API, visual representation, default or interaction model: verified.
Files:
.changeset/experimental-theme-rest-look-own-scope-focus.md: clear apart from the width case in the blocking finding.packages/cli/api/theme-edit/_settings.mjs: blocking finding (avar()orcalc()width is written into the colour).packages/cli/api/theme-edit/theme-rest-look-keeps-hover-and-focus.test.mjs: clear; it has no function-valued width case, which the fix adds.
… as the width Review finding on #13390: a width the split did not know (var(), calc()) became part of the color. calc/min/max/clamp read as widths; a var() is the one part still unsaid, and with more than one unsaid part the shorthand is copied as written (skipped where the resting scope sets any outline property).
|
/approve-spec 3f32b5a |
There was a problem hiding this comment.
Changes requested. An engineering owner's /approve-spec for this head settles the direction, and the earlier variable and calc() width finding is fixed; one defect needs a fix:
- When
longhandsinpackages/cli/api/theme-edit/_settings.mjscannot place avar()word it copies the wideroutlineas written (lines 7247-7248), and the copy then skips it whenever the resting scope sets any outline property (lines 7266-7267), so with a ghost focusoutline var(--focus-outline-width) solid var(--color-accent), a small-ghost focusoutline-offset 4pxoroutline-color #00aa00, andoutline none --when variant:ghost+size:sm, small ghost buttons show no keyboard focus ring where the base drew one.
Skipping that whole value only where the resting scope sets the outline shorthand itself, and otherwise writing it with the scope's own focus longhands after it, would fix it; a test with that two-var() outline beside a small-ghost outline-offset would guard it. Separately, and not blocking: a wider shorthand that leaves its colour out (outline 2px solid) no longer resets the colour at the resting scope, so a whole-part focus colour shows there instead of the text colour.
Claims and files checked
Review mode: incremental; reason: none
Release note claims:
- Under a resting outline for a variant and a size, a focus outline property the theme sets for that same scope stays as set: verified (the small ghost keeps its own green, in the browser and in the compiled CSS).
- The wider outline's other properties still come, so the ring shows in the scope's own colour: verified for literal and single-variable outlines; false for an outline copied as written beside any outline property the scope sets, where no ring shows (the blocking finding).
- An experimental patch for the CLI: verified.
Description claims:
- The change fixes a finding on the pull request it sits directly on: verified.
- Before, small ghost buttons got the ghost's black ring instead of their own green, and a dark-only whole-part red turned their dark-mode ring red: verified on the base in the compiled CSS.
- A wider focus outline is now copied per longhand, each skipped only where the resting scope sets that longhand itself, in every mode or the wider value's mode: verified for literal and single-variable outlines; false for an outline copied as written, which is skipped where the scope sets any outline property (the blocking finding).
- The small ghost keeps its green, gets the ghost's solid 2px ring, and the dark-only red is not copied over it: verified in the compiled CSS for light and dark, and in the browser for the variable-width form of the same case.
- A wider colour set for the plain focus state still reaches the small ghost: verified (its test passes on the head).
- The test file adds the green-with-ring and plain-focus cases and asserts the earlier cases as longhands: verified; it also adds a variable-width case.
- The theme-edit suite gives the same results as its base: partly verified: the 91 theme-edit test files that mention outline or focus pass on both, the head adding its three new tests (2361 passed on the head, 2358 on the base).
- No new public API, visual representation, default or interaction model, and no internal context in public text: verified.
Files:
.changeset/experimental-theme-rest-look-own-scope-focus.md: its ring claim fails in the blocking finding's case.packages/cli/api/theme-edit/_settings.mjs: blocking finding (the whole-shorthand fallback and its skip); non-blocking note on an omitted colour.packages/cli/api/theme-edit/theme-rest-look-keeps-hover-and-focus.test.mjs: clear; it has no case for an outline copied as written beside a property the resting scope sets.
…cope's own shorthand, as before Review finding on #13390: an outline of two variables was copied as written but skipped whenever the resting scope set any outline property, so small ghosts lost their ring. Such a shorthand is now skipped only where the resting scope sets the outline shorthand itself, as on the base.
|
/approve-spec b15a62a |
There was a problem hiding this comment.
Changes requested. An engineering owner's /approve-spec for this head settles the direction, and the earlier no-ring finding is fixed; one defect needs a fix:
- A wider
outlinethatlonghandscopies as written (twovar()parts,packages/cli/api/theme-edit/_settings.mjslines 7248-7249) is written after the resting scope's own focus longhands (line 7270) and replaces them, so with a ghost focusoutline var(--focus-outline-width) solid var(--color-accent), a small-ghost focusoutline-color #00aa00andoutline none --when variant:ghost+size:sm, small ghost buttons ring in the accent color instead of their own green, which the title and release note say no longer happens.
Writing the scope's own focus longhands again after a shorthand copied as written, or narrowing the title and release note to literal and single-variable outlines, would fix it; a test pairing that outline with a small-ghost outline-color would guard it. Separately, and not blocking: a wider shorthand that leaves its color out (outline 2px solid) still does not reset the color at the resting scope, so a whole-part focus color shows there instead of the text color.
Claims and files checked
Review mode: incremental; reason: none
Title:
- A focus outline the resting scope sets itself is not overwritten by a wider one: verified for literal and single-variable wider outlines; false for a wider outline copied as written, which replaces the scope's own color, style or width (the blocking finding).
Release note claims:
- Under a resting outline for a variant and a size, a focus outline property the theme sets for that same scope stays as set: verified for literal and single-variable wider outlines (the small ghost keeps its green in light and dark); false for a wider outline copied as written (the blocking finding).
- The wider outline's other properties still come, so the ring shows in the scope's own color: the ring shows in every case checked; "in the scope's own color" is false for a wider outline copied as written.
- An experimental patch for the CLI: verified.
Description claims:
- The change fixes a finding on the pull request it sits directly on: verified.
- Before, small ghost buttons got the ghost's black ring instead of their own green, and a dark-only whole-part red turned their dark-mode ring red: verified on the base in the browser.
- A wider focus outline is now copied per longhand, each skipped only where the resting scope sets that longhand itself, in every mode or the wider value's mode: verified for literal and single-variable outlines.
- The small ghost keeps its green, gets the ghost's solid 2px ring, and the dark-only red is not copied over it: verified in the browser in light and dark.
- A wider color set for the plain focus state still reaches the small ghost: verified (its test passes, and the compiled rule carries the color).
- A width or color given as a variable or
calc()is read as its part: verified for a variable width beside a literal color. - A shorthand with two such parts is copied as written, as before: verified (the compiled rule matches the base); it then replaces the scope's own longhands, as the blocking finding says.
- The test file adds the green-with-ring and plain-focus cases and asserts the earlier cases as longhands: verified; it also adds a variable-width case and a two-variable case beside an own offset.
- The theme-edit suite gives the same results as its base: partly verified: the 90 theme-edit test files that mention outline or focus pass on both, the head adding its four new tests (2356 passed on the head, 2352 on the base, 2 skipped on each); the rest of the suite was not run.
- No new public API, visual representation, default or interaction model, and no internal context in public text: verified.
Files:
.changeset/experimental-theme-rest-look-own-scope-focus.md: its own-color claim fails in the blocking finding's case.packages/cli/api/theme-edit/_settings.mjs: blocking finding (a shorthand copied as written lands after the scope's own longhands); non-blocking note on an omitted color.packages/cli/api/theme-edit/theme-rest-look-keeps-hover-and-focus.test.mjs: clear; its two-variable case pairs the copied outline only with an offset, which the shorthand does not reset.
| y.thing, | ||
| String(y.value), | ||
| ); | ||
| putComp({...y, thing: long, when: s.when, state}, target, long, v); |
There was a problem hiding this comment.
Blocking: a shorthand longhands returns whole (two var() words, or one with two parts unsaid, lines 7248-7249) is now written here, but putComp appends it after the longhands the resting scope already set in this rule, so it resets them. With a ghost focus outline var(--focus-outline-width) solid var(--color-accent), a small-ghost focus outline-color #00aa00 and outline none --when variant:ghost+size:sm, the small ghost's rule is { outline-color: #00aa00; outline: var(--focus-outline-width) solid var(--color-accent); }, and a focused small ghost rings in the accent color where the theme without the resting outline rings green (an own outline-style or outline-width is lost the same way; setting the small-ghost value after the resting outline gives it back). After writing a shorthand copied as written, write the scope's own focus longhands again so they follow it, and add the two-var() case with a small-ghost outline-color.
| '@astryxdesign/cli': patch | ||
| --- | ||
|
|
||
| [experimental] `astryx experimental theme editor set`: under a resting `outline` for a variant and a size, a focus outline property the theme sets for that same scope stays as set (a small ghost's own green), and the wider outline's other properties (the ghost's style and width) still come, so the ring shows in the scope's own color. |
There was a problem hiding this comment.
Blocking (claims): "a focus outline property the theme sets for that same scope stays as set … so the ring shows in the scope's own color" holds for literal and single-variable wider outlines, but not for one copied as written: a ghost outline var(--focus-outline-width) solid var(--color-accent) still replaces a small ghost's own outline-color (see the comment on _settings.mjs). Fix the code so the claim holds, or narrow the note (and the title) to the outlines it covers.
Fixes the review finding on #13357 (sits directly on it).
User impact
astryx experimental theme editor set: withoutline 2px solid #000000 --state focus-visible --when variant:ghost, thenoutline-color #00aa00 --state focus-visible --when variant:ghost+size:sm, thenoutline none --when variant:ghost+size:sm, small ghost buttons got the ghost's black ring instead of their own green; with a dark-only whole-partoutline-color #ff0000, their dark-mode ring turned red. A wider focus outline is now copied to the resting scope per longhand (style, width, color), each skipped only where that scope sets the longhand itself (in every mode, or the wider value's mode). So the small ghost keeps its green, gets the ghost's solid 2px ring, and the dark-only red is not copied over the green. A wider color set for--state focusstill reaches the small ghost. A width or color given asvar()orcalc()is read as its part; a shorthand with two such parts is copied as written, as before.Smallest restoration
packages/cli/api/theme-edit/_settings.mjs: the wider-value copy inwithFocusOutlineworks per longhand.packages/cli/api/theme-edit/theme-rest-look-keeps-hover-and-focus.test.mjs: the green-with-ring case, the--state focuscase, and the earlier cases asserted as longhands..changeset/experimental-theme-rest-look-own-scope-focus.md: the release note.Evidence
packages/cli/api/theme-edit/theme-rest-look-keeps-hover-and-focus.test.mjspackages/cli/api/theme-editsuite gives the same results as its base.Scope
Components: none (experimental theme editor only)
replay: worse 0 at b15a62a