Skip to content

experimental theme: a setting that changes a part's resting look keeps its hover and keyboard focus visible... - #12766

Merged
josephfarina merged 1 commit into
feature/theme-editorfrom
josephfarina/editor-rest-look-keeps-states
Nov 21, 2026
Merged

josephfarina merged 1 commit into
feature/theme-editorfrom
josephfarina/editor-rest-look-keeps-states

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

User impact

astryx experimental theme editor keeps 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 set or how commands, with its own test, and touches nothing outside packages/cli/api/theme-edit.

Smallest restoration

  • .changeset/experimental-theme-rest-look-keeps-hover-focus.md | 7 ++
  • packages/cli/api/theme-edit/_settings.mjs | 151 +++++++++++++++++++++++++++-
  • .../cli/api/theme-edit/theme-part-state-wins-build.test.mjs | 2 +-
  • packages/cli/api/theme-edit/theme-part-text-sits-core.test.mjs | 2 +-
  • .../theme-edit/theme-rest-look-keeps-hover-and-focus.test.mjs | 137 +++++++++++++++++++++++++
  • .../cli/api/theme-edit/theme-resting-shadow-part-rings.test.mjs | 36 ++++++-
  • .../cli/api/theme-edit/theme-state-part-states-changed.test.mjs | 2 +-
  • .../api/theme-edit/theme-titles-shadows-alpha-state.test.mjs | 2 +-

Evidence

Tests on this layer (CI=1, applied on its base in order):

  • packages/cli/api/theme-edit/theme-part-state-wins-build.test.mjs
  • packages/cli/api/theme-edit/theme-part-text-sits-core.test.mjs
  • packages/cli/api/theme-edit/theme-rest-look-keeps-hover-and-focus.test.mjs
  • packages/cli/api/theme-edit/theme-resting-shadow-part-rings.test.mjs
  • packages/cli/api/theme-edit/theme-state-part-states-changed.test.mjs
  • packages/cli/api/theme-edit/theme-titles-shadows-alpha-state.test.mjs

The whole packages/cli/api/theme-edit suite 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)

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

preflight: pass e12e7e9 (review deferred to batch: subagent cap)

@vercel

vercel Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 21, 2026 5:45am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 19, 2026
@astracat-bot

astracat-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🔄 In progress (for maintainers only) Nov 21, 2026, 5:32 AM UTC

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  • withFocusOutline returns before restoring anything when the part has any focus-state outline* setting for any variant (packages/cli/api/theme-edit/_settings.mjs:6756-6766), so outline-color '#ff0000' --on button --only --state focus-visible followed by outline none --on button --only compiles to a focus rule with only outline-color, leaving every button with no keyboard focus indicator, and a focus outline set for one variant does the same to all the others.
  • withOverlayStates still 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 before background transparent --on button is 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.

Automated review (maintainer link)

Comment on lines +6757 to +6765
if (
data.settings.some(
y =>
y.source === 'property' &&
/^outline/.test(kebab(y.thing)) &&
/^focus/.test(String(y.state ?? '')) &&
partsOf(ctx, y).includes(target),
)
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@josephfarina
josephfarina changed the base branch from josephfarina/editor-row-label-color to main November 21, 2026 05:32
@josephfarina
josephfarina force-pushed the josephfarina/editor-rest-look-keeps-states branch from f6d7cce to e12e7e9 Compare November 21, 2026 05:32
@josephfarina
josephfarina marked this pull request as ready for review November 21, 2026 05:32
@josephfarina
josephfarina changed the base branch from main to feature/theme-editor November 21, 2026 05:33
@josephfarina
josephfarina merged commit cd83649 into feature/theme-editor Nov 21, 2026
121 of 125 checks passed
josephfarina added a commit that referenced this pull request Nov 21, 2026
…ook keeps its hover and keyboard focus visible... (#12766)"

This reverts commit cd83649.
@github-actions
github-actions Bot deleted the josephfarina/editor-rest-look-keeps-states branch November 21, 2026 06:04
@josephfarina
josephfarina restored the josephfarina/editor-rest-look-keeps-states branch November 21, 2026 07:07
@github-actions
github-actions Bot deleted the josephfarina/editor-rest-look-keeps-states branch November 22, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — e12e7e93 Deployed Nov 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant