ui: headings open their section, and keep their help icon on one line

Two things, and the second was a regression this migration caused.

A heading had `margin: 0 0 10px` -- no top margin at all -- so it sat flush
against whatever came before and read as part of it rather than as the start of
the next thing.  On /more/statistics "Tags" touched the panel above it with a
0px gap.  Now 22px above and 10px below, because a heading belongs to what
follows it.

`* + .wrolpi-header` rather than a blanket margin, for the same reason
StatisticGroup needed it: a heading that opens a Panel or a page is already
where it should be, and pushing it down just dents the top of its own container.

The help icon on every HelpHeader and InfoHeader had dropped to its own line --
"Root CA Certificate" in Settings is the clearest one.  `.inline-header` set
`h1..h5 {display: inline-block}` so the heading and a sibling `<span>` shared a
row, which worked while these were a bare `<h2>` and stopped the moment they
gained a block wrapper: the `<label>`'s block child forced a break.

Fixed in the library rather than patched in App.css.  `Header` takes an `after`
slot rendered inside the heading element, where the existing flex row already
handles alignment and spacing.  Both wrappers pass their icon through it, the
`<label>` moves inside the heading so `for_` keeps associating the text with its
field (three call sites rely on it), and the `.inline-header` rules are deleted.
Fifteen call sites are fixed by fixing the two wrappers.

Tests: containment in jest, and the part jsdom cannot judge -- that the two
boxes actually share a line, and that the heading stays one row tall -- in a
browser.  Planted both original shapes: the margin removed, a blanket margin
denting its container, and the control moved back outside the heading element.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Roland 2026-08-01 18:41:58 -06:00
parent 2ce7601ebb
commit c18fe84783
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
8 changed files with 221 additions and 43 deletions

View file

@ -743,6 +743,30 @@ html[data-theme="night"] .wrolpi-tag::before {
margin: 0 0 10px;
}
/*
* A heading opens a section, so it needs more air above it than below — it belongs to
* what follows, not to what came before. With no top margin at all a heading sat flush
* against the panel above it, which read as part of that panel rather than as the start
* of the next thing (visible on /more/statistics, where "Tags" touched the panel above).
*
* `* +` rather than a blanket margin: a heading that opens a Panel or a page is already
* where it should be, and pushing it down would just dent the top of its own container.
*/
* + .wrolpi-header {
margin-top: 22px;
}
/*
* Trailing content keeps the heading's baseline but not its size: a help button rendered
* at heading scale is a 26px glyph next to a 17px word.
*/
.wrolpi-header-after {
display: inline-flex;
align-items: center;
font-size: 13px;
font-weight: 400;
}
.wrolpi-header-dividing {
border-bottom: 1px solid var(--border);
padding-bottom: 6px;