Repository navigation
experimental theme: text in a see-through region is measured over the region as drawn - #13299
Conversation
… 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]
|
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.
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.
- Text in a see-through top bar is measured over the bar blended onto the page (
--color-background-body), so white nav text onrgba(15,23,42,0.3)reports 2.46:1. - Text on the lightbox keeps
--color-overlayas 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.
| const measured = stops.map(stop => ({ | ||
| stop, | ||
| pair: drawn(fg, stop, m, beneath), | ||
| pair: drawn(fg, stop, m, beneath, !(/** @type {any} */ (p).mediaOf)), |
There was a problem hiding this comment.
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.
|
/approve-spec d6245eb |
There was a problem hiding this comment.
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.
|
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. |
|
Back in landing #13377. The review finding that took this out was in other changes of that landing, not in this one. |
- #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
|
Landed on main in #13377. |
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
rgba(15,23,42,0.3)bar, white top nav labels were measured on the bar's color as if solid and read fine.theme-contrast-measures-whats-drawn.test.mjs(see-through region, and a part on the page too).Scope
Components: theme editor (contrast checks)
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