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
USWDS - Accessibility: Added button functionality to usa-button links #4385
Conversation
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.
Thanks for updating this. Can you resolve conflicts and fix some formatting issues on href
?
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.
@mahoneycm thanks for all your work on this.
Aside from the requested changes, would you mind creating a unit test for it under spec/unit
?
@thisisdano This was something I worked on a while back for accessibility. Remembered it was wondering if we should readdress? |
Hi there! There's some interest from Login.gov in having this change implemented. Are there blockers or other considerations preventing this from being merged? Thanks |
@mejiaj Updated this PR for the latest USWDS! I also revised the PR description to make the work and problem more understandable. This included Dan's request to change |
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.
LGTM, usually we require a unit test for every new script. I'm not sure on this one given the very limited scope.
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.
Looks good!
Confirmed that:
- links styled with
.usa-button
are activated by bothspace
andenter
- links are identified as links in VoiceOver
For good measure, I also searched for any <a>
tags with type="button"
and couldn't find any.
A couple small things:
- Could you update the PR summary to match the changelog/release notes format? (Some details outlined here)
- Could you add details to the "Breaking changes" section so that users will know exactly what markup change they'll need to do?
- Also, this shouldn't need to block anything, but I'm wondering if we can make a story that explicitly demonstrates links styled as buttons. We have the example in the
button-group
story, but it is a bit hidden.
@amyleadem Updated the PR description with those two changes! I agree, I would like to highlight links styled as buttons somewhere as well. Do you think that this should be part of this PR or should I open up a new ticket for that work? |
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.
Thanks for updating the descriptions. I think it is fine to address the story as a follow-up. Will you open an issue so we don't lose track?
Added changelog PR uswds/uswds-site#2085 |
Summary
Added spacebar activation to links styled as buttons. This allows users to trigger these links the same way they would expect to trigger buttons.
usa-card
buttons have been replaced with links styled as buttons.This PR has two main goals based on @thisisdano's comments in #3690:
role="button"
1usa-card
buttons should be replaced with links 2Breaking change
usa-card
buttons have been replaced with links styled as buttons.Before:
After:
Related issue
Closes #3690
Related PRs
Changelog PR →
Preview link
usa-card w/ links styled as buttons
Preview link:
Problem statement
Links styled as buttons should be triggered as such
Solution
Create a simple JS file to target all anchors with the
usa-button
class and allow them to be triggered with the spacebarReplace buttons in
usa-card
withusa-button
anchor tagsTesting and review
button-group
storybook previewusa-button
classhref
to verify the page updatesBefore opening this PR, make sure you’ve done whichever of these applies to you:
git pull origin [base branch]
to pull in the most recent updates from your base and check for merge conflicts. (Often, the base branch isdevelop
).npm run prettier:js
to format any JS updates.npm test
and confirm that all tests pass.Additional information
href="#"
to allow links to be targeted through tabbing.npm run build:html
&npm run build:storybook
for good measure.Footnotes
https://github.com/uswds/uswds/issues/3690#issuecomment-951091169 ↩
https://github.com/uswds/uswds/issues/3690#issuecomment-951095032 ↩