review: a busy button is not a disabled one, and night's danger is not red

Acting on the review of #624.  Two bugs, both real, both confirmed in the
browser against the live stylesheet before fixing.

Mantine renders a loading button as `disabled={disabled || loading}`, so every
busy control in the app is `:disabled` -- an APIButton mid-request, the refresh
button, the flasher's connect.  Mantine's own grey repaint is careful to exclude
`[data-loading]` for exactly that reason; the new rule was not, so "working..."
faded to 0.45 and read as unavailable rather than active.  Measured: a loading
button came back at opacity 0.45.  Both roots now mirror Mantine's exclusion.

Night encodes danger as a dashed border on a transparent fill, because it has no
second hue to spend.  The general disabled rule repaints from `--button-bg` --
the filled red Mantine leaves in the variable -- and at (0,2,1) it tied with
`html[data-theme="night"] .wrolpi-button-danger` and won on source order.
Measured: background rgb(255,87,87), border solid transparent.  So the file
browser's Delete, which is role='danger' and disabled until a selection exists,
became a solid red chip in the one theme where that is not what danger means.
Restated at (0,3,1) so it no longer depends on where it sits in the file.

The specificity note in the comment was also wrong, and wrong in a way that
would mislead the next person: Mantine's disabled paint is
`:where(:disabled:not([data-loading]), ...)`, and `:where()` contributes
nothing, so it scores (0,1,0).  The `html` prefix is not needed to beat that --
it is needed to stay level with the app's own `html ...` overrides, and the
night danger collision is the demonstration.

The fade is now `--disabled-opacity`, read by the tests instead of restated, and
asserted for equality rather than against a band -- a band tolerates an
accidental different fade or an opacity leaking in from elsewhere and still
reports success.

Five new cases from the review: loading versus disabled (paired, so it cannot
pass by nothing fading at all), night's dashed danger with a light-theme inverse
proving the fill is not stripped everywhere, cross-colour distinctness in all
four themes rather than only light -- night and amber are where one hue makes
collapse most likely -- and an outline pair checking text and border, which are
the only things a fill-less variant has to lose.  Each planted: dropping the
loading exclusion reddens one, dropping the night restatement reddens one.

1128 jest / 63 suites, 216 in ui-layout.cy.js, clean npm run build.
This commit is contained in:
Roland 2026-08-02 16:53:18 -06:00
parent bb65cd0c28
commit e28c5740ce
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
2 changed files with 151 additions and 21 deletions

View file

@ -1193,6 +1193,9 @@ html[data-theme="amber"] .wrolpi-progress-fill {
*/
:root {
--card-poster-max-height: 200px;
/* How far a disabled control fades. Semantic used 0.45 and it reads correctly against
every theme's panel; the tests read this rather than repeating the number. */
--disabled-opacity: 0.45;
}
/*
@ -1476,21 +1479,50 @@ html[data-theme="amber"] .wrolpi-th-sort:focus-visible {
* the call site asked for is still in `--button-bg` and can simply be reinstated. `--button-bd`
* is a whole border shorthand, not a colour, so it is set with `border`.
*
* The `html` prefix beats Mantine's own `.m_hash:disabled` at (0,2,0) without needing
* `!important`.
* `:not([data-loading])` mirrors Mantine, and is not decoration. Mantine renders a loading
* button as `disabled={disabled || loading}`, so every busy control in the app is `:disabled`
* -- every APIButton mid-request, the refresh button, the flasher's connect. Its own grey
* repaint is careful to exclude them; without the same exclusion here, "working..." fades to
* 0.45 and reads as unavailable rather than busy.
*
* On specificity: Mantine's disabled paint is
* `.m_hash:where(:disabled:not([data-loading]), ...)`, and `:where()` contributes nothing, so
* it scores (0,1,0) -- a single class. The `html` prefix is not needed to beat THAT. It is
* needed to stay level with the app's other `html ...` overrides, and the night danger rule
* below shows why that matters: at equal specificity the later rule wins, which is how this
* one silently repainted night's dashed danger buttons until it was told not to.
*/
html .mantine-Button-root:disabled,
html .mantine-Button-root[data-disabled] {
html .mantine-Button-root:disabled:not([data-loading]),
html .mantine-Button-root[data-disabled]:not([data-loading]) {
background: var(--button-bg);
color: var(--button-color);
border: var(--button-bd);
opacity: 0.45;
opacity: var(--disabled-opacity);
}
html .mantine-ActionIcon-root:disabled,
html .mantine-ActionIcon-root[data-disabled] {
html .mantine-ActionIcon-root:disabled:not([data-loading]),
html .mantine-ActionIcon-root[data-disabled]:not([data-loading]) {
background: var(--ai-bg);
color: var(--ai-color);
border: var(--ai-bd);
opacity: 0.45;
opacity: var(--disabled-opacity);
}
/*
* Night keeps its dashed danger treatment when disabled.
*
* Night has no second hue to spend, so danger is encoded by a dashed border on a transparent
* fill rather than by a red fill. The general rule above repaints from `--button-bg`, which
* is the filled red Mantine put in the variable, and at (0,2,1) it tied with the night rule
* and won on source order -- turning the file browser's disabled Delete into a solid red chip
* in the one theme where a solid red chip is not what danger looks like.
*
* (0,3,1), so it does not depend on where it sits in the file. No `background`/`color`
* shorthand games: it restates the night treatment, and the fade comes from the rule above.
*/
html[data-theme="night"] .wrolpi-button-danger:disabled:not([data-loading]),
html[data-theme="night"] .wrolpi-button-danger[data-disabled]:not([data-loading]) {
background: transparent;
color: var(--danger);
border: 1.5px dashed var(--danger);
}