-
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
Checkbox: Labels don't have htmlFor #2274
Comments
@bmsterling Here's a codesandbox showing how you can set the |
@brianespinosa That's an interesting approach but it causes the below warning and doesn't add the
|
@brianespinosa I believe |
@bmsterling fair point. I didn't see that in the console when I threw that together for you. Let me go take a look at how I handled this in my own project. I'd tend to agree with you that we might want to add a way to more easily handle this. Using @levithomason or @layershifter thoughts on this? Maybe there's another solution that is already there that works better? |
True. I didn't consider this. Very roughly, and just an fyi, the changes I made to Checkbox.js are as followed:
and
Then I can do:
|
@bmsterling Thanks for the report. The proposed solution looks correct, howerer I think that we can pass all const [htmlInputProps, rest] = partitionHTMLInputProps(unhandled) Feel free to open a PR 👍 |
Steps
Using the wave toolbar
Expected Result
All labels are connected to inputs via the
for
attributeActual Result
No
for
attributeVersion
0.71.3
I'm working on a fix for this that is similar to these lines of code but wanted to ask some questions before I submit a PR.
for
attribute value should be theid
of the input that it relates to, butid
is not a required proptype. I'd like to make that required but I'm not sure what the ramifications will be sinceas
prop allows for a checkbox to be some other type of html element. Does anyone see a scenario where a requiredid
will cause issues?id
, if it is passed in, is applied to thediv
and not theinput
, again, I don't think there is any ill affects to having it applied to theinput
, but wanted to confirm?The text was updated successfully, but these errors were encountered: