ui: the corner icons opt out of the bar's foreground, so make them stop

Measuring the foreground against the bar is worth nothing if the icons ignore
it, and two of them did -- the search glyph and the hamburger came out blue on
every bar in every theme while the rest of the bar was correct.

Neither inherits.  An anchor takes `a {color: var(--blue)}` from tokens.css,
which outranks an inherited value however the bar sets it; the search glyph is
an anchor.  A Mantine ActionIcon paints `--ai-color`, its own themed blue, and
Mantine writes that variable INLINE on the element, so a stylesheet declaring it
loses every time -- the painted property has to be set instead.  The status
icons that link to /admin are anchors too, and only looked right because they
carry an inline colour of their own, which still wins and is meant to.

The test that claimed to cover this read `querySelector('...svg')`: one element,
the first, which was a plain inheriting Icon.  It asserted every icon and
measured the only one that was never broken.  It now reads querySelectorAll,
asserts the count, and checks all four -- and reddens in all four themes with
the rule removed, naming --blue as the value it found.

The gallery sample was wrong in the same direction: it used an IconButton for
the search icon, so it showed the ActionIcon fault twice and hid the anchor
fault entirely.  It now carries all three shapes the real bar puts in that
corner.

1115 jest / 62 suites, 177 in ui-layout.cy.js, clean npm run build.
This commit is contained in:
Roland 2026-08-02 14:12:39 -06:00
parent 24fcf978d9
commit a9d12952a8
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
3 changed files with 72 additions and 10 deletions

View file

@ -42,6 +42,35 @@
background: rgba(0, 0, 0, 0.12);
}
/*
* Everything in the bar takes the bar's foreground.
*
* `color: inherit` on the links alone was not enough, because two of the things in the
* corner do not inherit at all and both came out blue on every bar in every theme:
*
* - An anchor takes `a {color: var(--blue)}` from tokens.css, which outranks an inherited
* value however the bar sets it. The search glyph is an anchor, and so is every status
* icon that links to /admin -- those only looked right because they carry an inline
* colour of their own, which still wins here and is meant to.
* - A Mantine ActionIcon paints `--ai-color`, its own themed blue. The hamburger and the
* theme toggle are ActionIcons. The variable is no use as a hook: Mantine writes it
* INLINE on the element, so a stylesheet declaring it loses every time (the same trap
* as `--group-justify` on Pagination). The painted property has to be set instead, and
* `html` lifts this over Mantine's own single-class rule.
*
* Measuring the foreground against the bar is worth nothing if the icons opt out of it.
*/
.wrolpi-navbar a,
html .wrolpi-navbar .mantine-ActionIcon-root {
color: inherit;
}
/* The bar's own hover, rather than a blue tint from Mantine's palette. */
html .wrolpi-navbar .mantine-ActionIcon-root:hover {
background: rgba(0, 0, 0, 0.12);
color: inherit;
}
.channel-edit {
border-radius: 3px;
padding: 0.75em;