mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-26 09:56:17 -05:00
review: the color-scheme half of this was already there
Acting on review of #644. The largest finding came out of a suggestion rather than being in it. The reviewer asked for coverage of the `color-scheme: dark` rule, on the grounds that dropping it would leave night's track wrong with no failing test. Written and passing -- then mutated, by pointing the selector at a type that does not exist, and the tests stayed green. Mantine's own stylesheet puts `color-scheme: var(--mantine-color-scheme)` on `:root`, and ThemeProvider drives it with `forceColorScheme`. The property is inherited, so a range slider on a dark theme has had a dark track all along and the rule added here changed no pixel. It is deleted, and the claim about "the UA's pale slab" is out of the comments and the gallery copy with it. The tests stay, re-aimed at what actually supplies it: breaking `forceColorScheme` fails all three, which is worth guarding because it lives in another module and every accent assertion passes without it. The other suggestions: - The gallery slider misrepresented the control it stands for -- it invented an "Error" step, dropped Trace and ran 0..4, where Settings maps 1..5 onto Critical / Warning / Info / Debug / Trace. A gallery whose purpose is showing the real control is worse than useless when it shows a different one. Keyed to match `levelNameMap` exactly, and it starts at Info so both halves of the track are visible. - The "never leaves it at the UA default" test restated the four above it: `toRgb` throws on anything unresolved, and the computed value of `accent-color: auto` is the keyword, so those already fail on an unstyled slider. Replaced with a constraint they do not cover -- `accent-color` is inherited, so a text field beside the slider must still read `auto`, which is what says the accent comes from this rule and not from a tinted document. - The comment implied native checkboxes and radios are on screen the way sliders are. They are not: those are Mantine's and Progress is a div, so three of the four selectors are a guard rather than a fix. Said so. Nits: four product sliders, not five -- the fifth is the sample itself. And the progressive-enhancement limit is now stated where the rule is, including what a complete fix would take. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e15e2fd993
commit
5873e65e8c
3 changed files with 97 additions and 51 deletions
|
|
@ -78,9 +78,15 @@ const Row = ({children}) => <div style={{display: 'flex', gap: 10, flexWrap: 'wr
|
|||
{children}
|
||||
</div>;
|
||||
|
||||
// The labels Settings shows beside its own log-level slider, so the sample reads like the
|
||||
// control it stands in for rather than a bare number.
|
||||
const logLevelNames = ['Critical', 'Error', 'Warning', 'Info', 'Debug'];
|
||||
/*
|
||||
* The labels Settings shows beside its own log-level slider, so the sample reads like the
|
||||
* control it stands in for rather than a bare number.
|
||||
*
|
||||
* Keyed 1..5 to match `levelNameMap` and the `<datalist>` in Settings.js exactly. The first
|
||||
* version of this invented an "Error" step, dropped Trace, and ran 0..4 -- a gallery whose
|
||||
* job is to show the real control misrepresenting it is worse than not showing it.
|
||||
*/
|
||||
const logLevelNames = {1: 'Critical', 2: 'Warning', 3: 'Info', 4: 'Debug', 5: 'Trace'};
|
||||
|
||||
/*
|
||||
* One navigation bar, in one of the twelve colors a user can pick for it.
|
||||
|
|
@ -153,9 +159,10 @@ export function ThemeSamplePage() {
|
|||
const [wideConfirmOpen, setWideConfirmOpen] = useState(false);
|
||||
const [comments, setComments] = useState(true);
|
||||
const [hotspot, setHotspot] = useState(true);
|
||||
// Draggable, because the accent only shows on the FILLED half of the track -- a slider
|
||||
// parked at either end shows almost none of the color this section is here to check.
|
||||
const [logLevel, setLogLevel] = useState(2);
|
||||
// Draggable, and starting at Info rather than at either end: the accent only shows on the
|
||||
// FILLED half of the track, so a slider parked at a limit shows almost none of the color
|
||||
// this section is here to check, or none of the unfilled track beside it.
|
||||
const [logLevel, setLogLevel] = useState(3);
|
||||
const [dismissed, setDismissed] = useState(false);
|
||||
const [modalOpen, setModalOpen] = useState(false);
|
||||
const [realColors, setRealColors] = useState(false);
|
||||
|
|
@ -719,8 +726,8 @@ export function ThemeSamplePage() {
|
|||
<input
|
||||
type='range'
|
||||
id='sample_range'
|
||||
min={0}
|
||||
max={4}
|
||||
min={1}
|
||||
max={5}
|
||||
step={1}
|
||||
value={logLevel}
|
||||
onChange={e => setLogLevel(parseInt(e.target.value))}
|
||||
|
|
@ -730,9 +737,10 @@ export function ThemeSamplePage() {
|
|||
<p style={{fontSize: '0.75rem', color: 'var(--muted)', marginTop: 8, marginBottom: 0}}>
|
||||
A range slider is drawn by the browser, not by us — so with nothing said
|
||||
about it the UA paints it in its own fixed blue, which no theme can reach.
|
||||
Check it in night: the accent follows <code>--blue</code> like a link does,
|
||||
and the unfilled half of the track is dark rather than the UA's pale slab.
|
||||
Settings and three of the calculators each have one.
|
||||
Check it in night: the accent follows <code>--blue</code> like a link does.
|
||||
The accent reaches the thumb and the filled half only; the rest of the
|
||||
track comes from the browser's own dark palette, which the theme already
|
||||
selects. Settings and three of the calculators each have one.
|
||||
</p>
|
||||
</Panel>
|
||||
</Section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue