test: act on review — and one of the seven turned out to be undemonstrable

Six real fixes and one honest retraction.

The control is now a SIBLING of the heading inside a flex row, not a child of
it.  Inside the `<h3>` it joined the heading's accessible name, so screen reader
heading navigation announced "Root CA Certificate Help".  The row is what keeps
them on one line, and it is only rendered when there is something to sit beside,
so the markup for the other 46 call sites is unchanged.

`style` now lands on the wrapper.  It used to reach the outer div; going through
Header put it on the inner heading, where a margin sets space INSIDE the wrapper
and only worked at all through margin collapse -- which stops the moment the
wrapper gains padding or a border.  Status's "Drive Bandwidth" is the live case:
verified 16px on the block, 0 on the h2.  Text properties still arrive, because
colour and text-align inherit; the `color` PROP stays on the heading.

A `<label>` only when `for_` names a field.  Several call sites pass an
InfoHeader as the `label` prop of InputForm/ToggleForm, which wraps it in a
label of its own -- an unconditional one nested labels, which is invalid and
makes clicking the text ambiguous.  Verified: zero `label label` on
/videos/settings, where "Video Resolutions" keeps its label and "Video File
Format" no longer has one.

The help controls carried `iconStyle: {margin: '0.5em'}`, which separated a
free-floating sibling and, inside the row, added to the gap on every side.
Zeroed; the row's gap is the spacing.

The browser test mounted a plain Button in an `after` slot rather than a real
HelpHeader, so the default icon chrome above was exactly what it could not see.
It mounts the real wrapper now.  Two of my assertions were also too weak to
catch what they claimed: the gap was measured to `.wrolpi-header-after`, a flex
container whose own rect does not move when a child gains a margin, so it had to
measure the button; and the squeeze case used a title of ordinary words, which
simply wraps and never puts the row under pressure.

Renamed the suites -- "keeps the icon on its own line" read as the opposite of
the fix.

The retraction: `flex-shrink: 0` is declared but has NO test. Three attempts
could not find a width where removing it changes what is painted -- the row's
only other item is a heading, and its automatic minimum size absorbs the
pressure; the help control is an ActionIcon with a min-width it will not go
below either.  The declaration stays as a statement of intent, with a comment
saying it is unproven, rather than a green test that does not discriminate.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Roland 2026-08-01 19:00:32 -06:00
parent 5491a82361
commit f153d7c8d8
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
6 changed files with 174 additions and 43 deletions

View file

@ -820,11 +820,24 @@ export function InfoHeader({
* The label stays, now inside the heading, because `for_` associates the text with a
* field on three of these call sites.
*/
/*
* A `<label>` ONLY when `for_` names a field. Several call sites pass an InfoHeader as
* the `label` prop of InputForm/ToggleForm, which wraps whatever it is given in a
* `<label>` of its own -- an unconditional label here nests one inside another, which is
* invalid HTML and confuses what clicking the text does. That predates this change; it
* is fixed here rather than carried forward.
*
* `margin: 0` on the icon because the row's `gap` does the spacing now. The 0.5em
* default was there to separate a free-floating sibling, and inside the row it adds to
* the gap on every side.
*/
return <Header as={headerSize} {...props} after={
<InfoPopup content={popupContent} iconSize={iconSize} icon={icon} position={popupPosition}
{...popupProps}/>
iconStyle={{margin: 0}} {...popupProps}/>
}>
<label htmlFor={for_}>{headerContent} {required && <RequiredAsterisk/>}</label>
{for_
? <label htmlFor={for_}>{headerContent} {required && <RequiredAsterisk/>}</label>
: <>{headerContent} {required && <RequiredAsterisk/>}</>}
</Header>
}
@ -864,12 +877,15 @@ export function HelpHeader({
required = false,
...props
}) {
// See the note in InfoHeader: the icon belongs in the heading's row, not beside it.
// See the notes in InfoHeader: the control belongs in the heading's row, a label only
// when it names a field, and the row's gap is the spacing.
return <Header as={headerSize} {...props} after={
<HelpModal helpPath={helpPath} iconSize={iconSize} icon={icon} title={helpTitle}
{...helpModalProps}/>
iconStyle={{margin: 0}} {...helpModalProps}/>
}>
<label htmlFor={for_}>{headerContent} {required && <RequiredAsterisk/>}</label>
{for_
? <label htmlFor={for_}>{headerContent} {required && <RequiredAsterisk/>}</label>
: <>{headerContent} {required && <RequiredAsterisk/>}</>}
</Header>
}