-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add RadioGroup
#121
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
Add RadioGroup
#121
Conversation
13f39d2 to
fe7ef63
Compare
fe7ef63 to
57246ca
Compare
2ad253e to
b5008c8
Compare
benoitgrelard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the radio package isn't really useful on its own if we're going to offer a higher level API like radio-group.
|
@benoitgrelard I've moved |
|
I need to reintroduce |
6f5d35f to
15213fb
Compare
|
This is ready for you again @benoitgrelard ❤️ |
6801cc7 to
d5d2f95
Compare
|
After a quick chat with @benoitgrelard , We've agreed to rethink the |
|
I'm going to hold on reviewing this one until we get |
d5d2f95 to
1087d4d
Compare
1087d4d to
096d363
Compare
d606529 to
3a53a1f
Compare
| ...groupProps | ||
| } = props; | ||
| const labelId = useLabelContext(); | ||
| const labelledBy = ariaLabelledby || labelId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b81f103 to
2056739
Compare
2056739 to
ae961b8
Compare
ae961b8 to
dbb287b
Compare
dbb287b to
962eeeb
Compare
|
@jjenzz Just to catch me up, is this ready for me to review now? I see @benoitgrelard has approved already. |
|
@chaance Yes it is, we wanted to wait for you to have a look at it. |
chaance
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor changes requested then GTG 👍
|
@chaance I think I've resolved your feedback but may have misunderstood 🙈 let me know if there's more you're hoping for here. |
c4d807b to
47e5e46
Compare
There are some significant changes to
Labelhere for discussion. I remembered that it is invalid markup to have multiple form controls in alabel(ourCheckboxandSwitchwhich render aninputand abuttonwould be invalid), so:spanby default with arole="label"attribute. It still does thearia-labelledbystuff so is read out fine in SRs.htmlForattribute, it will switch to alabelunder the hood.asattribute, it will use whatever they pass.Because this is now a
spanby default I added a click handler that will click/focus the element ref passed to the label context hook. This means we can make the label click/focus thebuttonin these controls instead of the hiddeninput.Using a
spanalso allows us to nest labels which is useful for things like thisRadioGroupwhere the group should have anaria-labelledbyand each radio can also be labelled:I like this because it means that if you want to label something, you can just do it without worrying about structure.