-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FormField: required
prop not passed to control
#911
Comments
The issue/featureRestating the issue, we pass all "unhandled" props to the underlying control. So, the required prop is consumed and applied to the FormField, rather than the Input: The issue here is that we don't know which props to pass down since you can use any control: IdeasPass a hard list of propsOne possible solution here is to define a hard list of props that we pass down to certain components. What I don't like here is that it is naive, only applying to certain props for certain control components. I'd prefer a more robust solution that applies to any prop for any component. We actually already do this for the Provide a
|
Looks like we're already in agreement here. Let's just pass |
See #917 |
Steps
required
prop to form field, e.g.<Form.Field control={Input} required />
Expected Result
required
prop would be passed toInput
Actual Result
required
prop not passed toInput
Version
0.61.2
Testcase
http://codepen.io/jeffcarbs/pen/JbWLYa
The issue is that
Form.Field
has arequired
prop (which applies therequired
class to the wrappingdiv.field
element) so it "consumes" the prop. This means it never gets passed to theInput
. As you can see in the codepen where I manually used<Input required />
, modern browsers will automatically prevent the form submission if a required field is blank (among other validations). I think in addition to using therequired
prop for the className theForm.Field
should passrequired
down to the control.The text was updated successfully, but these errors were encountered: