Skip to content

Commit f9a428e

Browse files
talissoncostaclaude
andcommitted
fix(a11y): size and centre the field label info icon
The design puts the info icon at 20x20 beside the label; ours asked for 12, and since info-outlined draws its circle across 20 of a 24 viewBox that rendered a 10px target. It is 16 now. It also sat 2px above the text. .control-label is display: block, so the tooltip's inline-flex wrapper took part in inline layout, and an inline-flex box whose only child is a replaced element baselines on its bottom margin edge rather than its content. The svg { vertical-align: bottom } rule alongside it cannot correct that: vertical-align is ignored on flex items. Laying the label out as a centred flex row puts the icon dead on the text centre. vertical-align: middle was the other candidate and overshoots by 1.3px, aligning to half the x-height rather than the cap centre. That goes on FieldLabel's own element, not on .control-label. Nine hand-written labels across six other files carry that class, none of them with an icon to align, so they keep display: block and this touches only what FieldLabel renders. The stylesheet is unchanged. Checked against block: the label keeps its full width, and a long label still wraps to the same height. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 237d79f commit f9a428e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

frontend/web/components/base/forms/FieldLabel.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ const FieldLabel: FC<FieldLabelProps> = ({
2727
tooltip,
2828
tooltipPlace = 'top',
2929
}) => (
30-
<label id={id} htmlFor={htmlFor} className={cn('control-label', className)}>
30+
<label
31+
id={id}
32+
htmlFor={htmlFor}
33+
className={cn('control-label d-flex align-items-center', className)}
34+
>
3135
{children}
3236
{required && (
3337
<span className='text-danger ml-1' aria-hidden>
@@ -36,7 +40,7 @@ const FieldLabel: FC<FieldLabelProps> = ({
3640
)}
3741
{tooltip && (
3842
<Tooltip
39-
title={<Icon name='info-outlined' width={12} height={12} />}
43+
title={<Icon name='info-outlined' width={16} height={16} />}
4044
place={tooltipPlace}
4145
titleClassName='cursor-pointer ml-1 d-inline-flex align-items-center'
4246
>

0 commit comments

Comments
 (0)