Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upfix(radio): group radio inputs in docs (axe-core) #2684
Conversation
This comment has been minimized.
This comment has been minimized.
PatternFly-React preview: https://patternfly-react-pr-2684.surge.sh |
This comment has been minimized.
This comment has been minimized.
Thanks for working on this, @boaz0! First of all, your solution is valid in terms of accessibility. However, I question if we should be fixing this issue at all. If I use the Radio component in the context of a form, I would expect to provide a visible label that names the group of radio buttons. There is an issue related to this in core that's still open and provides a suggestion on how to handle that: patternfly/patternfly-next#953 That issue is in the context of the Form component, which would consume the Radio component. If we want to handle how radio buttons are grouped, I think that would be addressed in the Form component. If we were to update the Radio component with this PR, how would that update affect the ability to define the group and group label in the context of the Form component? If we rely on this grouping and naming to happen in the Form component, is it ok to have this component fail the a11y audit? My concern with trying to make things accessible out of context is that the consumer might not realize that the additional markup was only included because the component was out of context. My suggestion would be to not address a11y failures in situations like this, and instead refer the consumer to a component or demo that illustrates how to use the component in an accessible way. I'm curious what others think about this. |
This comment has been minimized.
This comment has been minimized.
How about aligning the example with what we have in the pf4 core here - it will fix the a11y message till patternfly/patternfly-next#953 will be solved. What do you think? Thanks. |
This comment has been minimized.
This comment has been minimized.
@boaz0 |
This comment has been minimized.
This comment has been minimized.
I think that there's a valid use case to use Radio buttons outside of forms. Otherwise we shouldn't be providing these examples of them outside forms. We can include the details that Jenn mentioned on how to make them accessible in the context of a form in the Form's documentation page. @jgiardino Let's talk about what developers should know about forms and accessibility and write some docs! |
This comment has been minimized.
This comment has been minimized.
My apologies on being so dense on this one. I needed the CSS army to explain to me that our example of the Radio component passes the aXe audit because we're using different values for the @boaz0 If you were referring to this example in core, then yes, I think aligning with that example makes sense. |
This comment has been minimized.
This comment has been minimized.
|
On second look, the buttons are broken on the preview link and both are checked at the same time. |
@boaz0 I was just about to say the same thing as Zack above. I noticed the radio functionality seems to be broken. :( |
This comment has been minimized.
This comment has been minimized.
I'm not sure if this is still the goal or not, but my understanding with creating examples is that they should be similar between core and react. The example from core also doesn't wrap the radio buttons in the same group (i.e. creating the behavior you described). @jessiehuff @redallen I also question if that's something that should block this PR or not. I thought the scope of this PR was to address the accessibility issue found by aXe, and since the behavior between core and react examples seem to match, I think this PR could move forward. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Here is the example from html. The ability to select a radio button in a group is native to html, and not functionality that's provided by javascript. cc'ing @mcoker on this to weigh in on whether we should be wrapping the Radio component with additional things that are not part of the component in our component examples (e.g. like a |
This comment has been minimized.
This comment has been minimized.
@jgiardino this PR looks good to me. My expectation is that the examples should match, too, whenever possible. That said, for this example, I think the examples should just ideally just represent the component, and not include anything that isn't necessary to demonstrate the component's functionality. Here I think labeling the radio button examples as checked/unchecked would suffice to serve as an example for the radio component, then we illustrate how radio buttons should be named, grouped, etc in the context of a form in a demo. |
This comment has been minimized.
This comment has been minimized.
We chatted about it as a team and decided to keep any additional form elements needed to create a group of radio buttons in a form out of the component examples, and since it's a big confusing now that you can't toggle between radio buttons (like you would in a form), just to update the examples so we only have a single radio in the example, instead of a group. I created an issue to do that in the core workspace here - patternfly/patternfly-next#2221. Can we do that for the examples in the react workspace, too? |
This comment has been minimized.
This comment has been minimized.
@mcoker yes - I will update according to patternfly/patternfly-next#2221 |
This comment has been minimized.
This comment has been minimized.
Thanks for making these updates! I only see a couple of updates needed for the example Label wraps input radio:
|
This comment has been minimized.
This comment has been minimized.
@jgiardino thank you for the review. |
This comment has been minimized.
This comment has been minimized.
@boaz0 yep! |
This comment has been minimized.
This comment has been minimized.
@jgiardino @mcoker done - I added Let me know what you think. I have a question though when I am in "label wraps input" making the window slower doesn't put the label in one row and the radio button in the second row. Am I missing something? Thanks. |
packages/patternfly-4/react-core/src/components/Radio/Radio.tsx
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
Ah, the difference between the normal and "label wraps input" variations doesn't have anything to do with content wrapping onto multiple lines. It shows how to have the
And when the label wraps, it's:
|
This comment has been minimized.
This comment has been minimized.
LGTM - Great job! :) |
Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
This comment has been minimized.
This comment has been minimized.
codecov-io
commented
Oct 2, 2019
•
Codecov Report
@@ Coverage Diff @@
## master #2684 +/- ##
==========================================
+ Coverage 68.97% 68.97% +<.01%
==========================================
Files 857 857
Lines 23445 23452 +7
Branches 1847 1850 +3
==========================================
+ Hits 16171 16177 +6
Misses 6357 6357
- Partials 917 918 +1
Continue to review full report at Codecov.
|
This comment has been minimized.
This comment has been minimized.
@tlabaj conflict was fixed. |
LGTM |
LGTM! |
This comment has been minimized.
This comment has been minimized.
Your changes have been released in:
Thanks for your contribution! |
This comment has been minimized.
This comment has been minimized.
Thank you all!! |
boaz0 commentedAug 12, 2019
What:
closes #2568
Radio inputs that have the same name should be grouped. One way to group them is inside a div with
role="group"
andaria-label
to describe this group.//cc @christiemolloy