Bring back the ability to pass the required attribute down to the native input element.
In V1.x users of react-select could rely on the required attribute being passed down to the native input element. This allowed for using native validation for required select fields when used in a form element. In V2 that has been removed and now forms that use required select fields can submit without being properly validated by the browser (at least to cover the required validation use case). This is an important feature that our team relied on until we can build out more robust validation.
Not a feature request IMO, the documentation says that setting the required prop would apply the HTML5 required attribute, but it doesn't.
@buesing I think that you're referring to the v1 documentation. The required property was specifically removed in v2 as stated in the prop update guide. I would love to see support for required to be added again. I'd also appreciate hearing the reasoning behind removing it in the first place.
If anyone's looking for a workaround for this @brunocramos posted one here: https://github.com/JedWatson/react-select/issues/1827#issuecomment-409343434
Also I threw together a general use component to use as a stop gap solution with working examples here: https://codesandbox.io/s/github/orther/react-select-v2-required-input/tree/master/
Instead of writing less code with react components we now need to write more code as we used to with build-in html5 elements. At least react-select should provide a property like "inputProps" to inject the native-input.
Possible duplicate: https://github.com/JedWatson/react-select/issues/1453
This issue still exists.
would really appreciated support for the required attribute!
Greetings everyone!
We have identified this as high priority, moderate complexity, and something that has been requested by others. In an attempt to collect and better serve the intention of this issue, I will be closing this and related tickets requesting required/validation to put priority focus and attention on https://github.com/JedWatson/react-select/issues/4327
I hope you all can join the conversation there as there is new momentum behind this project. We are putting together releases for version v3.2 and v4 (more details coming in the next 24 hours) and your input could help determine if this makes it into either of those two or an even later version.
Thank you and appreciate your patience and input.
Most helpful comment
@buesing I think that you're referring to the v1 documentation. The
requiredproperty was specifically removed in v2 as stated in the prop update guide. I would love to see support forrequiredto be added again. I'd also appreciate hearing the reasoning behind removing it in the first place.