USWDS - Accessibility: Added button functionality to usa-button links#4385
Conversation
mejiaj
left a comment
There was a problem hiding this comment.
Thanks for updating this. Can you resolve conflicts and fix some formatting issues on href?
mejiaj
left a comment
There was a problem hiding this comment.
@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 |
mejiaj
left a comment
There was a problem hiding this comment.
LGTM, usually we require a unit test for every new script. I'm not sure on this one given the very limited scope.
amyleadem
left a comment
There was a problem hiding this comment.
Looks good!
Confirmed that:
- links styled with
.usa-buttonare activated by bothspaceandenter - 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-groupstory, 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? |
amyleadem
left a comment
There was a problem hiding this comment.
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-cardbuttons have been replaced with links styled as buttons.This PR has two main goals based on @thisisdano's comments in #3690:
role="button"1usa-cardbuttons should be replaced with links 2Breaking change
usa-cardbuttons 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-buttonclass and allow them to be triggered with the spacebarReplace buttons in
usa-cardwithusa-buttonanchor tagsTesting and review
button-groupstorybook previewusa-buttonclasshrefto 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:jsto format any JS updates.npm testand confirm that all tests pass.Additional information
href="#"to allow links to be targeted through tabbing.npm run build:html&npm run build:storybookfor good measure.Footnotes
https://github.com/uswds/uswds/issues/3690#issuecomment-951091169 ↩
https://github.com/uswds/uswds/issues/3690#issuecomment-951095032 ↩