Skip to content

Commit adae13c

Browse files
authored
fix(S2): ContextualHelp in Field wrapping to new line (#7491)
* fix ContextualHelp wrapping to new line * allow wrapping of label, but don't just wrap ContextualHelp * remove marginStart
1 parent adc21f8 commit adae13c

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

packages/@react-spectrum/s2/src/Field.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -127,21 +127,23 @@ export const FieldLabel = forwardRef(function FieldLabel(props: FieldLabelProps,
127127
)}
128128
</Label>
129129
{contextualHelp && (
130-
<CenterBaseline
131-
styles={style({
132-
display: 'inline-flex',
133-
height: 0,
134-
marginStart: 4
135-
})}>
136-
<ContextualHelpContext.Provider
137-
value={{
138-
id: contextualHelpId,
139-
'aria-labelledby': labelProps?.id ? `${labelProps.id} ${contextualHelpId}` : undefined,
140-
size: (size === 'L' || size === 'XL') ? 'S' : 'XS'
141-
}}>
142-
{contextualHelp}
143-
</ContextualHelpContext.Provider>
144-
</CenterBaseline>
130+
<span className={style({whiteSpace: 'nowrap'})}>
131+
&nbsp;
132+
<CenterBaseline
133+
styles={style({
134+
display: 'inline-flex',
135+
height: 0
136+
})}>
137+
<ContextualHelpContext.Provider
138+
value={{
139+
id: contextualHelpId,
140+
'aria-labelledby': labelProps?.id ? `${labelProps.id} ${contextualHelpId}` : undefined,
141+
size: (size === 'L' || size === 'XL') ? 'S' : 'XS'
142+
}}>
143+
{contextualHelp}
144+
</ContextualHelpContext.Provider>
145+
</CenterBaseline>
146+
</span>
145147
)}
146148
</div>
147149
);

0 commit comments

Comments
 (0)