Repository navigation
fix: Replace Input with outlined TextField in WizardInputs — GH#4752 - #5012
properGrammar wants to merge 5 commits into
Conversation
Signed-off-by: Graham Arthur Mackenzie <gam@Grahams-MacBook-Air.local>
Signed-off-by: Graham Arthur Mackenzie <gam@mac.mynetworksettings.com>
| FormControl, | ||
| FormControlLabel, | ||
| FormHelperText, | ||
| Input, // still needed — used as base component for Select in MUI v4 |
There was a problem hiding this comment.
I don't see anythig breaking when you remove this import, are you sure it's necessary?
There was a problem hiding this comment.
Regarding "I don't see anythig breaking when you remove this import, are you sure it's necessary?"
OP (@balhar-jakub) said herein Input import kept Input is still used internally by MUI's Select component in v4. Removing the import could cause subtle issues. which is why I left it in... Happy to remove it.
There was a problem hiding this comment.
Yes, both imports can be removed, I couldn't find anything that would need it here and lint would fail if we keep it.
| className="wizardFormFields" | ||
| helperText={caption} | ||
| InputLabelProps={{ shrink: true }} | ||
| FormHelperTextProps={{ id: captionId }} |
There was a problem hiding this comment.
Adding this breaks helper text helper. Remove FormHelperTextProps={{ id: captionId }} and the captionId variable. Add a test that the input's aria-describedby points to the helper text's ID.
There was a problem hiding this comment.
Now that I've removed FormHelperText (see comment above), I'm happy to also remove FormHelperTextProps... Will look into adding the requested test.
There was a problem hiding this comment.
Update: the correct formatting returns when both FormHelperText and FormHelperTextProps are removed, so will def keep that change. Still need to look into the requested test...
There was a problem hiding this comment.
Updated! I've removed FormHelperTextProps and the unused captionId variable so MUI handles the ID association natively. I also added the unit test to WizardInputs.test.jsx to verify that aria-describedby links correctly to the helper text element, which is passing locally and will be included in this push.
| ))} | ||
| </Select> | ||
| </FormControl> | ||
| ); |
There was a problem hiding this comment.
I know this was not changed in this PR, but it is related to the description in the issue:
The problem: a wizard step that has both free-text and option fields now mixes two styles:
- Text fields: a bordered box with the label set into the top border, full width.
- Dropdowns: the old underline only, label above, normal width, and a different class (formField).
Issue #4752 asked for clear borders around inputs, so the dropdowns don't get the fix. The step also looks less consistent than before, when everything used the underline style.
Why variant="outlined" on Select alone isn't enough: in Material-UI v4 an outlined dropdown needs three pieces set up together.
- FormControl variant="outlined" tells InputLabel to use the outlined label position. Without it, the label stays in the underline-style position and overlaps the border.
- InputLabel id=... plus Select labelId=... connects the label to the dropdown for screen readers.
- Select label={question} sizes the gap in the top border where the label sits. Without it, the border runs straight through the label text. Because the label is forced up with shrink, notched should also be set so the gap is there even when no value is selected.
There was a problem hiding this comment.
No worries that we're stepping outside the bounds of the original PR! Happy to address things more holistically..
I've updated the dropdown renderer to set variant="outlined", fullWidth, and className="wizardFormFields" on <FormControl/>, while passing labelId, label, and notched to <Select/>. Both text fields and dropdowns now match; will post the push asap here for your approval.
All I'm still in need of is confirmation from @balhar-jakub that Input needs to be kept in...
|
Thanks for the thorough review! I've updated the PR to address all of your feedback:
Like I said above, the last step for now is for @balhar-jakub / someone else to thumbs up or down the inclusion of |
…perText props, and add test Signed-off-by: Graham Arthur Mackenzie <gam@Grahams-MacBook-Air.local>
d78b399 to
4e614eb
Compare
Signed-off-by: Graham Arthur Mackenzie <gam@Grahams-MacBook-Air.local>
90d70f1 to
d03c9d4
Compare
Description
Replaces the MUI
FormControl+InputLabel+Input+FormHelperTextstructure inWizardInputs.jsxwith a single<TextField variant="outlined" />. This adds visible outer borders to static onboarding wizard input fields, making them clearly readable.Linked to #4752
Type of change
How Has This Been Tested?
api-catalog-ui:npmTestpasses cleanly (69 suites, 351 tests).api-catalog-ui:npmLintpasses without errors.Checklist: