Repository navigation
experimental theme: a setting that changes a part's resting look keeps its hover and keyboard focus visible... - #12766
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Changes requested. The three restorations work for a lone resting setting, and the new tests fail on the base and pass here, but two guards in the new helpers still drop the states they are meant to keep:
withFocusOutlinereturns before restoring anything when the part has any focus-stateoutline*setting for any variant (packages/cli/api/theme-edit/_settings.mjs:6756-6766), sooutline-color '#ff0000' --on button --only --state focus-visiblefollowed byoutline none --on button --onlycompiles to a focus rule with onlyoutline-color, leaving every button with no keyboard focus indicator, and a focus outline set for one variant does the same to all the others.withOverlayStatesstill writes Core's overlay into a variant's hover the theme set itself when the resting background has no--when(_settings.mjs:6710-6720), so a ghost hover gradient set beforebackground transparent --on buttonis replaced by Core's overlay, against the changeset's "A state the theme sets itself keeps what it set."
Checking per variant and per property what the theme sets for that state, with tests for both setting orders, fixes both.
Claims and files checked
Review mode: full; reason: no-earlier-review
Claims:
- Changeset and description, the editor keeps a part's hover and keyboard focus visible when a setting changes its resting look: verified for a lone resting setting; false in the two cases above.
- Changeset and description, a resting background shorthand gives the part's hover and press Core's layer back: verified (the new test fails on the base and passes here; every button variant, press under a coarse pointer too).
- Changeset and description, Core's focus and hover rings are drawn over a resting shadow, so a bevel never covers them: verified (the new bevel test and five updated expectations fail on the base and pass here).
- Changeset and description, a resting outline gives the part's focus state Core's focus outline back: verified alone; false after a focus-ring colour or a one-variant focus outline (first finding).
- Changeset and description, a state the theme sets itself keeps what it set: verified within the same scope; false for a whole-part resting background after a variant's own hover (second finding).
- Description, stacked on the branch below, with only its own commit to review: verified, one commit over its base.
- Description, the editor is experimental, each change has its own test, and nothing outside the theme-edit folder changes: verified (seven files there plus the changeset).
- Description, the listed files and line counts: verified.
- Description, the six listed test files pass: verified (31 passed, 1 skipped).
- Description, the folder's whole suite fails only what its base fails: partly verified; 54 more test files there that set these properties pass here apart from one test that fails the same way on the base; the rest of the suite was not run.
- Description, eslint and prettier are clean on the changed files: verified.
- Description, no new public API, default or interaction model, and no internal context in public text: verified.
Files:
.changeset/experimental-theme-rest-look-keeps-hover-focus.md: two claims false (both findings).packages/cli/api/theme-edit/_settings.mjs: both findings.packages/cli/api/theme-edit/theme-rest-look-keeps-hover-and-focus.test.mjs: clear; it does not cover the two failing cases.packages/cli/api/theme-edit/theme-resting-shadow-part-rings.test.mjs: clear.packages/cli/api/theme-edit/theme-part-state-wins-build.test.mjs: clear.packages/cli/api/theme-edit/theme-part-text-sits-core.test.mjs: clear.packages/cli/api/theme-edit/theme-state-part-states-changed.test.mjs: clear.packages/cli/api/theme-edit/theme-titles-shadows-alpha-state.test.mjs: clear.
| if ( | ||
| data.settings.some( | ||
| y => | ||
| y.source === 'property' && | ||
| /^outline/.test(kebab(y.thing)) && | ||
| /^focus/.test(String(y.state ?? '')) && | ||
| partsOf(ctx, y).includes(target), | ||
| ) | ||
| ) |
There was a problem hiding this comment.
This returns before any restore when the part has a focus-state setting of any outline* property, for any variant. outline-color '#ff0000' --on button --only --state focus-visible followed by outline none --on button --only compiles to .astryx-button:focus-visible { outline-color: #ff0000; } with no style or width, so no button shows keyboard focus; a focus outline set only for --when variant:destructive leaves primary, secondary and ghost with no focus rule. Skipping only the properties the theme sets for that state (style and width) and only the variants it sets them for (no when, or the variant being restored) keeps the rest restored.
| y.source === 'property' && | ||
| /^background(-image)?$/.test(kebab(y.thing)) && | ||
| y.state === state && | ||
| (y.when == null || y.when === s.when) && |
There was a problem hiding this comment.
With a whole-part resting background (s.when unset), a hover the theme set for one variant (y.when === 'variant:ghost') does not match here, so Core's overlay is written into that variant's own hover block: a ghost hover linear-gradient(#ff0000, #0000ff) set first ends up as linear-gradient(var(--color-overlay-hover),var(--color-overlay-hover)), and a #eeeeee hover gets the overlay on top only when it was set first. Checking inside the variant loop whether the theme sets that variant's state (y.when unset or variant:<variant>) keeps it.
…s its hover and keyboard focus visible: a resting background shorthand gives the hover and press their layer back, Core's rings go over a resting shadow, and a resting outline gives the focus state Core's focus outline back
f6d7cce to
e12e7e9
Compare
User impact
astryx experimental theme editorkeeps a part's hover and keyboard focus visible when a setting changes its resting look: a resting background shorthand gives the part's hover and press Core's layer back; Core's focus and hover rings are drawn over a resting shadow, so a bevel never covers them; and a resting outline gives the part's focus state Core's focus outline back. A state the theme sets itself keeps what it set.Problem and solution fit
The theme editor is experimental. Each change is one behaviour of its
setorhowcommands, with its own test, and touches nothing outsidepackages/cli/api/theme-edit.Smallest restoration
Evidence
Tests on this layer (CI=1, applied on its base in order):
packages/cli/api/theme-edit/theme-part-state-wins-build.test.mjspackages/cli/api/theme-edit/theme-part-text-sits-core.test.mjspackages/cli/api/theme-edit/theme-rest-look-keeps-hover-and-focus.test.mjspackages/cli/api/theme-edit/theme-resting-shadow-part-rings.test.mjspackages/cli/api/theme-edit/theme-state-part-states-changed.test.mjspackages/cli/api/theme-edit/theme-titles-shadows-alpha-state.test.mjsThe whole
packages/cli/api/theme-editsuite on the top of this stack fails only what its base fails in the same environment (app-copy and compile-check fixtures); eslint and prettier are clean on the changed files.Scope
Components: theme editor (CLI, experimental)
preflight: pass e12e7e9 (review deferred to batch: subagent cap)