Skip to content

Commit 4a5dfdb

Browse files
authored
Fix field label overriding display property (#2164)
* Fix Numberfield sidelabel in form * Make field fill 100% width though
1 parent d3b099a commit 4a5dfdb

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ function Field(props: SpectrumFieldProps, ref: RefObject<HTMLElement>) {
4747
);
4848

4949
children = React.cloneElement(children, mergeProps(children.props, {
50-
className: classNames(
51-
labelStyles,
52-
'spectrum-Field-field'
53-
)
50+
style: {width: '100%'}
5451
}));
5552

5653
return (
@@ -68,7 +65,13 @@ function Field(props: SpectrumFieldProps, ref: RefObject<HTMLElement>) {
6865
elementType={elementType}>
6966
{label}
7067
</Label>
71-
{children}
68+
<div
69+
className={classNames(
70+
labelStyles,
71+
'spectrum-Field-field'
72+
)}>
73+
{children}
74+
</div>
7275
</div>
7376
);
7477
}

0 commit comments

Comments
 (0)