ui: a disabled button keeps its own colour

The file browser's footer is eight buttons, six of them disabled until something
is selected, so the toolbar a user meets on arriving at /files was an
undifferentiated grey row: Delete, Rename, Move, Ignore and Tag rendered as five
identical pixels.  Colour is how those are told apart at a glance.

Mantine repaints a disabled button flat grey -- background, text and border all
replaced with `--mantine-color-disabled`.  Semantic kept the colour and dropped
the whole control to `opacity: 0.45`; measured on the QA Pi, a disabled Delete
is still red at 0.45, Rename still yellow, Tag still violet.  That is the better
signal: it says "not available" without also saying "no longer the delete
button".

Mantine leaves the variables alone and overrides only the painted properties, so
the colour the call site asked for is still sitting in `--button-bg` and can
simply be reinstated.  Applies to every disabled Button and ActionIcon, not only
the file browser's -- it is one convention, and having two would be worse than
either.

A pre-existing test earned its keep here: the IconStack corner disc was pinned
to `--mantine-color-disabled` so it would follow a disabled button's grey, and
it reddened the moment the button stopped being grey.  That override is gone;
`--button-bg` is now correct in both states, so the general rule covers them.

Ten new cases.  Fill equality is checked against each button's own enabled twin
in all four themes, and separately across the five colours at once -- comparing
each against its twin would still pass if every pair were grey, which is the
actual bug.  Opacity is asserted from both sides, because keeping the colour
must not cost the affordance.  Removing the rule reddens eleven.

1128 jest / 63 suites, 209 in ui-layout.cy.js, clean npm run build.
This commit is contained in:
Roland 2026-08-02 16:38:41 -06:00
parent 4d6a6d467d
commit bb65cd0c28
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
2 changed files with 157 additions and 9 deletions

View file

@ -54,7 +54,7 @@
/*
* A stack inside a button is the one case the call site should not have to describe,
* because the surface changes underneath it: Mantine paints a filled button from
* `--button-bg` but a disabled one from `--mantine-color-disabled`, whatever its variant.
* `--button-bg`, and the disc has to follow it into whatever state the button is in.
* The file browser's New Folder button is disabled in WROL mode, so a disc pinned to the
* enabled fill would be a blue chip on a grey button -- the original hole, inverted.
*
@ -70,10 +70,13 @@
background: var(--button-bg, var(--icon-stack-bg, var(--bg)));
}
.mantine-Button-root:disabled .wrolpi-icon-stack-corner,
.mantine-Button-root[data-disabled] .wrolpi-icon-stack-corner {
background: var(--mantine-color-disabled);
}
/*
* There is deliberately no `:disabled` override here any more. There used to be one pinning
* the disc to `--mantine-color-disabled`, because Mantine repainted a disabled button grey
* and a disc left on `--blue` became a blue chip on a grey surface. Disabled buttons now
* keep their own fill (see the disabled-button rule further down), so `--button-bg` is
* correct in both states and the rule above covers them.
*/
/* ---------------------------------------------------------------- Buttons */
/*
@ -1455,3 +1458,39 @@ html[data-theme="amber"] .wrolpi-th-sort:focus-visible {
.wrolpi-table-scroll {
overflow-x: auto;
}
/*
* A disabled button keeps its own colour.
*
* Mantine repaints one flat grey -- background, text and border all replaced with
* `--mantine-color-disabled`. Semantic kept the colour and dropped the whole control to
* `opacity: 0.45`, and that is the better signal: it says "not available" without also
* saying "no longer the delete button".
*
* The file browser is where the difference shows. Its footer is eight buttons, six of them
* disabled until something is selected, so the toolbar a user meets on arriving at /files was
* an undifferentiated grey row -- Delete, Rename, Move, Ignore and Tag all the same pixel.
* Colour is how those are told apart at a glance.
*
* Mantine leaves the variables alone and overrides only the painted properties, so the colour
* 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`.
*/
html .mantine-Button-root:disabled,
html .mantine-Button-root[data-disabled] {
background: var(--button-bg);
color: var(--button-color);
border: var(--button-bd);
opacity: 0.45;
}
html .mantine-ActionIcon-root:disabled,
html .mantine-ActionIcon-root[data-disabled] {
background: var(--ai-bg);
color: var(--ai-color);
border: var(--ai-bd);
opacity: 0.45;
}