fix(react-input, react-textarea): Fix Field control size handling - #36453
fix(react-input, react-textarea): Fix Field control size handling#36453dmytrokirpa wants to merge 1 commit into
Conversation
📊 Bundle size reportUnchanged fixtures
|
|
Pull request demo site: URL |
| @@ -0,0 +1,7 @@ | |||
| { | |||
There was a problem hiding this comment.
🕵🏾♀️ visual changes to review in the Visual Change Report
vr-tests-react-components/Field 11 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Field.Select+horizontal.default.chromium.png | 5924 | Changed |
| vr-tests-react-components/Field.Dropdown+horizontal.default.chromium.png | 6002 | Changed |
| vr-tests-react-components/Field.Combobox+horizontal.default.chromium.png | 6024 | Changed |
| vr-tests-react-components/Field.Textarea+horizontal.default.chromium.png | 2696 | Changed |
| vr-tests-react-components/Field.size-large.default.chromium.png | 3841 | Changed |
| vr-tests-react-components/Field.Dropdown.default.chromium.png | 3582 | Changed |
| vr-tests-react-components/Field.Input+horizontal.default.chromium.png | 5610 | Changed |
| vr-tests-react-components/Field.size-small.default.chromium.png | 3841 | Changed |
| vr-tests-react-components/Field.Combobox.default.chromium.png | 3608 | Changed |
| vr-tests-react-components/Field.Select.default.chromium.png | 3208 | Changed |
| vr-tests-react-components/Field.Textarea.default.chromium.png | 3543 | Changed |
vr-tests-react-components/Menu Converged - submenuIndicator slotted content 1 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Menu Converged - submenuIndicator slotted content.default - RTL.submenus open.chromium.png | 404 | Changed |
vr-tests-react-components/Positioning 2 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Positioning.Positioning end.chromium.png | 906 | Changed |
| vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png | 314 | Changed |
vr-tests-react-components/ProgressBar converged 2 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - Dark Mode.default.chromium.png | 85 | Changed |
| vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - High Contrast.default.chromium.png | 66 | Changed |
vr-tests-react-components/TagPicker 2 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/TagPicker.disabled - Dark Mode.chromium.png | 658 | Changed |
| vr-tests-react-components/TagPicker.disabled - RTL.disabled input hover.chromium.png | 635 | Changed |
There were 2 duplicate changes discarded. Check the build logs for more information.
| }); | ||
|
|
||
| expect(result.current.input.value).toBe('test'); | ||
| expect(result.current.size).toBe('large'); |
There was a problem hiding this comment.
q: is this expected behaviour in terms of design language consistency ? user can go wild and use various sizes between field/input ?
There was a problem hiding this comment.
From a design language point of view, I’m not sure this is behaving as expected. In the all controls implementation, context values act as defaults, and component props override them.
| const fieldControlProps = useFieldControlProps_unstable(props, { | ||
| supportsLabelFor: true, | ||
| supportsRequired: true, | ||
| supportsSize: true, |
There was a problem hiding this comment.
with these changes is this prop dead API now ? it is still used in TagPickerInput, should we reflect these changes there as well ?
There was a problem hiding this comment.
it's not a dead API, it just doesn't make sense for base hooks as they shouldn't have style props (size/appearance/etc)
There was a problem hiding this comment.
I'll double check for TagPicker and other components
There was a problem hiding this comment.
TagPicker didn't use the supportsSize: true and its sizes doesn't map to Field sizes, but Combobox, Dropdown and Select components have been fixed
66e12cc to
b13bb7e
Compare

Fixes Field control size handling for textfield-like controls.
Changes
useInputto default from Field context (fieldContext?.size ?? 'medium').useTextareato default from Field context (fieldContext?.size ?? 'medium').useComboboxto default from Field context (fieldContext?.size ?? 'medium').useDropdownto default from Field context (fieldContext?.size ?? 'medium').useSelectto default from Field context (fieldContext?.size ?? 'medium').supportsSize: truefromuseFieldControlProps_unstableoptions in Input and Textarea.Packages affected
Beachball change files have been created for all affected packages.
Before (all inputs don't respect field size)
After (inputs respect field size)