FormHelperText should not render when inside a FormControl that has isInvalid set
See original GitHub issueBug report
Describe the bug
The docs suggest that FormHelperText
should be hidden when inside an invalid FormControl
(reference), but this doesn’t actually happen; FormHelperText
remains visible.
To reproduce
- Render a
FormControl
with aFormHelperText
andFormErrorMessage
inside. SetisInvalid
on theFormControl
.
<FormControl isInvalid>
<FormLabel>FormLabel</FormLabel>
<Input />
<FormHelperText>FormHelperText</FormHelperText>
<FormErrorMessage>FormErrorMessage</FormErrorMessage>
</FormControl>
- Observe: the
FormErrorMessage
displays (as it should), but theFormHelperText
remains visible, which it should not.
Minimal reproduction
Sandbox: https://codesandbox.io/s/lingering-cherry-ub5fd?file=/src/index.tsx
Expected behavior
When a FormControl
is set to isInvalid
, the FormHelperText
should not be rendered.
Screenshots
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
FormHelperText disappears when isInvalid is set to true on the ...
Bug report Describe the bug When isInvalid is set to true on the FormControl the FormHelperText disappears To reproduce Email address.
Read more >Form Control - Chakra UI
If you render FormErrorMessage and isInvalid is false or undefined , FormErrorMessage won't be visible. The only way to make it visible is...
Read more >Material <Select> helperText does not work with react-hook ...
I'm using yup to display error/ ...
Read more >Chakra UI with 'redwoodjs/forms' elements - Solutions
Chakra UI with 'redwoodjs/forms' elements ... *The Chakra docs describe how to set isValid=false and display the FormErrorMessage. However, afaics ...
Read more >FormGroup and FormControl in Angular - LogRocket Blog
Every form input you have in a reactive form should be bound by a form ... in a group is invalid, the entire...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@with-heart, from my initial design,
FormHelperText
should not be visible whenFormErrorMessage
is shown. I think it’s a sensible default assumption.I’ll check the docs and keep them in sync.
I merged @ChasinHues’s PR already.
@KarenEfereyan Thank you so much for wanting to help with this. @ChasinHues already created a PR hence the reason why I didn’t chime in on time to help you.
Okay