-
Notifications
You must be signed in to change notification settings - Fork 12
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
va-checkbox and va-radio-option: Improved a11y #1442
base: main
Are you sure you want to change the base?
Conversation
@Andrew565 Could we fix the box size and radius to align with the USWDS? Attached shows the USWDS with a 20x20 square size and border radius of 2px. The focus state in the Figma design has a gap between the focus state and the gold outline, USWDS is showing the same thing. Could we follow that design for the focus state. The USWDS also shows a gap. |
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.
@Andrew565 This looked good to me. I was able to confirm that this resolves the Axe issues. I also gave it a quick test in VoiceOver and everything sounded as expected.
One minor thing I saw was when initially tabbing to the radio group, there's an additional outline next to the first item. My guess is that a stray pseudo or hidden element might be getting styled.
@rsmithadhoc Fixed the ghost outline, thanks for pointing that out. @babsdenney I fixed the outline gaps and made sure the sizing was consistent for both radios and checkboxes. If you inspect a non-checked checkbox or radio, it will appear in the sizing model as though it's 16x16, but this isn't including the 2px border on all sides, which raises the 'total size' to 20x20. Screenshots attached. |
@Andrew565 That makes sense! I don't know where the sizing strays, I overlayed the USWDS elements with the VADS and you can still see that the VADS radio buttons and checkboxes are slightly smaller. It looks like the selected radio button is accurate and matches the USWDS but the selected checkbox state and unselected radio and checkbox states are smaller than USWDS. I also am not sure if this makes a difference but the click area for the USWDS checkboxes and radio buttons is larger than the VADS checkboxes. You can click farther to the right on the UWDS elements. This doesn't make a difference, so it is not necessary to change, but the example we use for the name is misspelled in the storybook for the radio buttons. |
@babsdenney Figured out that the USWDS components were 20x20 PLUS a 2px box-shadow, making them effectively 24x24, which is why the size discrepancy. Fixed this for the checkboxes and radio-options, and also fixed the "Soujourner" typo. Should be good for re-review again now. |
}); | ||
return ( | ||
<div class="usa-radio"> |
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.
It looks like this update will require us to diverge almost completely from the USWDS packages with these classes being removed:
usa-radio__input
usa-radio
There are similar USWDS classes for va-checkbox
too.
Is it possible to keep some USWDS style for padding/margin, spacing, font-size, border-radius by keeping those USWDS classes there and just override whatever we need to override in the component stylesheet? Otherwise we will no longer be receiving any of those upstream updates.
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.
FWIW, the usa-radio
class is still there, it's just moving to the containerClass
variable.
As for the rest of the classes that are changing, yes, they are diverging quite a bit from the original USWDS classes, which is why I felt it made sense to replace those classes wholesale rather than try and override them.
For the usa-radio__input
vs. va-radio-option__input
, as an example, in our old stylesheet we were overriding just the margin and position, the USWDS doesn't provide any other styles beyond those. In the new stylesheet, we're overriding the margin, position, height, width, border, and box-shadow properties.
In the old styles and layout, the radio button and checkbox "icons" were being generated on the labels using a ::before
pseudo-element. In the new styles and layout, we're generating those "icons" on the inputs themselves.
Getting the 'tile' variant to display correctly likewise required moving the styles to the div
container, rather than having them live with the label
element, due to the label
not encompassing the input
element.
So we aren't really getting anything useful from USWDS for these elements any more, so I don't see us needing to receive any upstream updates, unless USWDS completely restructures these components in a way similar to how we've done it.
Chromatic
https://3363-redo-radios-and-checks--65a6e2ed2314f7b8f98609d8.chromatic.com
Description
Closes #3363
Reworks some of the HTML for the va-checkbox and va-radio-option components to be more accessible.
QA Checklist
Screenshots
Before:
After:
Acceptance criteria
Definition of done