Skip to content

experimental theme: text in a see-through region is measured over the region as drawn - #13299

Merged
josephfarina merged 1 commit into
feature/theme-editorfrom
josephfarina/theme-a/01b2-see-through-region
Nov 21, 2026
Merged

josephfarina merged 1 commit into
feature/theme-editorfrom
josephfarina/theme-a/01b2-see-through-region

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Text in a translucent top bar is measured over the bar as drawn, not over the bar's color taken as solid.

Problem and solution fit

Text in a region (a top nav item in the top bar) was measured on the region's color taken as solid, whatever its alpha. A translucent bar shows the page through it, so a problem was named that is never drawn, or a real one missed. The region is now blended onto the page first. A surface Core draws in its own scheme (a lightbox, over its media and a blurred page) keeps its own color as the ground. A part also drawn on the page (a button) keeps its page measurement.

Evidence

  • Before: on a rgba(15,23,42,0.3) bar, white top nav labels were measured on the bar's color as if solid and read fine.
  • After: measured on the faint bar blended onto the white page they report about 2.46:1; a solid white bar still reports 1:1; a secondary button's white text on the page is still reported.
  • Regression test: theme-contrast-measures-whats-drawn.test.mjs (see-through region, and a part on the page too).

Scope

Components: theme editor (contrast checks)

  • 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.

Testing

The touched tests, the stack's theme-editor tests, the CLI strict typecheck and eslint, on this layer's tree.

Gate

preflight: pass d6245eb
replay: worse 0 at d6245eb

… region as drawn

Text in a region (a top nav item in the top bar) was measured on the region's color taken as solid, whatever its alpha. A translucent bar shows the page through it, so a problem was named that is never drawn, or a real one missed. The region is now blended onto the page first. A surface Core draws in its own scheme (a lightbox, over its media and a blurred page) keeps its own color as the ground. A part also drawn on the page keeps its page measurement.

[skip ci]
@vercel

vercel Bot commented Nov 21, 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 12:03pm UTC

Request Review

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

astracat-bot Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 21, 2026, 1:24 PM 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.

Approval waits on an engineering owner's decision about which ground the experimental theme editor's contrast check measures; no defect blocks it.

No current spec defines this, so an engineering owner needs to approve the two readings below, or name the spec that governs them, by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner.

  1. Text in a see-through top bar is measured over the bar blended onto the page (--color-background-body), so white nav text on rgba(15,23,42,0.3) reports 2.46:1.
  2. Text on the lightbox keeps --color-overlay as an opaque ground; measured like the top bar, the neutral base theme's secondary button there would read 3.64:1.

Non-blocking: the base comparison in packages/cli/api/theme-edit/_compiler.mjs (lines 905-910) calls drawn() without the lightbox flag, so it blends the overlay that the measurement takes as opaque; passing !p.mediaOf there too keeps the two readings alike.

CI has not run on this head.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: text in a translucent top bar is measured over the bar blended onto the page, not over the bar's colour as solid. Verified: _compiler.mjs:741-755; the new test fails on the base and passes on the head.
  • Claim: the old reading could name a problem that is never drawn or miss a real one. Verified both ways: a faint white bar over the dark page was reported at 1:1 on the base and not on the head; a faint dark bar over the light page was missed on the base.
  • Claim: before, white labels on a rgba(15,23,42,0.3) bar read fine; after, about 2.46:1. Verified (2.46:1).
  • Claim: a solid white bar still reports 1:1. Verified.
  • Claim: a lightbox keeps its own colour as the ground. Verified: removing the flag at line 874 makes the new test fail.
  • Claim: a part also drawn on the page (a secondary button) keeps its page measurement. Verified by the second test (white text still reported at 1.28:1).
  • Claim: no new public API, default or interaction model. Verified: no export, command or option changes.
  • Claim: no internal context in the public text. Verified.
  • Claim: the touched tests, the theme-editor tests, the CLI strict typecheck and eslint pass. Verified for the touched test, the theme-editor tests that cover the top bar and the lightbox, eslint on both changed files, and the strict typecheck once the neutral theme is built.
  • File .changeset/experimental-theme-contrast-see-through-region.md: clear.
  • File packages/cli/api/theme-edit/_compiler.mjs: one non-blocking note (lines 905-910).
  • File packages/cli/api/theme-edit/theme-contrast-measures-whats-drawn.test.mjs: clear.

Automated review (maintainer link)

const measured = stops.map(stop => ({
stop,
pair: drawn(fg, stop, m, beneath),
pair: drawn(fg, stop, m, beneath, !(/** @type {any} */ (p).mediaOf)),

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.

Non-blocking: the base comparison a few lines below (const was = drawn(baseValue(p, 'fg', m), baseValue(p, 'bg', m), m, baseBeneath), lines 905-910) does not pass this flag, so for a lightbox pair it blends the base --color-overlay onto the page while this measurement takes it as opaque. Measured that way, the neutral base theme's secondary button on the lightbox reads 3.64:1, so in the light pass a theme's lightbox text failing between about 3.6:1 and 4.5:1 is skipped as no worse than the base (the dark pass still reports it). Passing !(/** @type {any} */ (p).mediaOf) there too keeps the two readings alike.

@josephfarina
josephfarina marked this pull request as ready for review November 21, 2026 13:00
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec d6245eb

@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.

Approved: an engineering owner approved both contrast readings for this head with /approve-spec, and no defect blocks the change.

Non-blocking: the base comparison in packages/cli/api/theme-edit/_compiler.mjs (lines 905-910) calls drawn() without the lightbox flag, so it blends the overlay that the measurement takes as opaque; passing !p.mediaOf there too keeps the two readings alike.

CI's test and lint workflows run only on pull requests into main, so they did not run on this pull request into the feature branch; the new tests and eslint pass on this head.

Claims and files checked

Review mode: same-head; reason: none

  • Claim: text in a translucent top bar is measured over the bar blended onto the page, not over the bar's colour as solid. Verified: _compiler.mjs:749-755; the new test fails on the base and passes on the head.
  • Claim: the old reading could name a problem that is never drawn or miss a real one. Verified both ways: a faint white bar over the dark page was reported at 1:1 on the base and not on the head; a faint dark bar over the light page was missed on the base.
  • Claim: before, white labels on a rgba(15,23,42,0.3) bar read fine; after, about 2.46:1. Verified (2.46:1).
  • Claim: a solid white bar still reports 1:1. Verified.
  • Claim: a lightbox keeps its own colour as the ground. Verified for the measurement: removing the flag at line 874 makes the new test fail; the base comparison at lines 905-910 blends it (non-blocking note above).
  • Claim: a part also drawn on the page (a secondary button) keeps its page measurement. Verified by the second test (white text still reported at 1.28:1).
  • Claim: a regression test covers the see-through region and a part also on the page. Verified: both tests run against the real neutral theme and pass.
  • Claim: one change with no tagalong, and no new public API, default or interaction model. Verified: no export, command or option changes.
  • Claim: no internal context in the public text. Verified.
  • Claim: the touched tests, the theme-editor tests, the CLI strict typecheck and eslint pass. Verified at this head.
  • Claim: preflight passes at this head. Verified for the change-scoped checks above; the full preflight was not re-run.
  • Claim: a replay run reports nothing worse at this head. Not checkable from the repository; not relied on.
  • File .changeset/experimental-theme-contrast-see-through-region.md: clear.
  • File packages/cli/api/theme-edit/_compiler.mjs: one non-blocking note (lines 905-910).
  • File packages/cli/api/theme-edit/theme-contrast-measures-whats-drawn.test.mjs: clear.

Automated review (maintainer link)

@josephfarina
josephfarina merged commit eeaaa20 into feature/theme-editor Nov 21, 2026
13 checks passed
josephfarina added a commit that referenced this pull request Nov 21, 2026
… region as drawn (#13299)

Reviewed pull request #13299, merged into the theme working branch. It reaches main with the branch's next landing.
@josephfarina

Copy link
Copy Markdown
Contributor Author

Taken out of landing #13377 because the review of the combined head flagged a line this change made. It stays on the working branch and rides the next landing together with its fix: open the fix as a new pull request based on the working branch (it already holds this change), whose description names #13299.

josephfarina added a commit that referenced this pull request Nov 21, 2026
… region as drawn (#13299)

Reviewed pull request #13299, merged into the theme working branch. It reaches main with the branch's next landing.
@josephfarina

Copy link
Copy Markdown
Contributor Author

Back in landing #13377. The review finding that took this out was in other changes of that landing, not in this one.

josephfarina added a commit that referenced this pull request Nov 21, 2026
- #13284 experimental theme: the newer-recipe release note agrees with the kept-palette one
- #13159 fix(cli): experimental theme editor - rounder corners never make the chat corners less round
- #13243 set: a text size token a part never reads goes into the one its held parts read
- #13299 experimental theme: text in a see-through region is measured over the region as drawn
- #12772 experimental theme how: a label that names the spacing or corners setting reads its value as that setting's; sans after a kind of typeface is the typeface
- #12773 experimental theme how: a contradiction holds back only its own pair; a decimal is one value; a color for the whole theme takes its role
- #13309 perf(cli): theme how makes its every-word check's patterns once per lexicon
- #13224 fix(cli): experimental theme editor - a group height narrowed off one control stays a control height show lists
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed on main in #13377.

josephfarina added a commit that referenced this pull request Nov 21, 2026
…sured as that part draws them (#13300)

Reviewed pull request #13300, merged into the theme working branch with only its own changes (the layer below it, #13299, is already here). It reaches main with the branch's next landing.
josephfarina added a commit that referenced this pull request Nov 21, 2026
…sured as that part draws them (#13300)

Reviewed pull request #13300, merged into the theme working branch with only its own changes (the layer below it, #13299, is already here). It reaches main with the branch's next landing.
josephfarina added a commit that referenced this pull request Nov 21, 2026
…sured as that part draws them (#13300)

Reviewed pull request #13300, merged into the theme working branch with only its own changes (the layer below it, #13299, is already here). It reaches main with the branch's next landing.
@github-actions
github-actions Bot deleted the josephfarina/theme-a/01b2-see-through-region branch November 22, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — d6245ebe 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