Skip to content

Conversation

mahoneycm
Copy link
Contributor

@mahoneycm mahoneycm commented Oct 30, 2023

Summary

Restores underlines to footer links in default states. Now, footer links meet WCAG 2.0 AA requirements.

Breaking change

This is not a breaking change

Related issue

Closes #5557

Related pull requests

Changelog →

Preview link

Default footer →

Big footer →

Slim footer →

Problem statement

Currently, footer links do not meet WCAG 2.0 AA accessibility requirements.

The link text must have a 3:1 contrast ratio from the surrounding non-link text.

The link must present a "non-color designator" (typically the introduction of the underline) on both mouse hover and keyboard focus.

WCAG recognizes that meeting these contrast requirements “is not the preferred technique to differentiate link text”. Of course the easy solution to this is to simply underline links in their default state. Interestingly, underlined links can be the exact same color as their surrounding text, though this is far from optimal. 1

Solution

Restore underlines to links in default states.

Alternative solution

We could alternatively increase the color contrast of links to have at least a 3:1 contrast ratio to surrounding texts.

This solution seems a bit more opinionated and relies on users to have not modified the colors of their footer text and/or links to ensure compliance.

Screenshots

Develop

image

After fix

image

Testing and review

  1. Inspect each footer variant in mobile, tablet, and desktop.
  2. Confirm that links to external pages each have underlines.
  3. Confirm this meets accessibility criteria.

Testing checklist

  • All footer links meet accessibility criteria in all states/viewports.
  • Alternatives are considered and decided that this is the best route.
  • Confirm accordion button links on links the mobile Big Footer variant do not need underlines.
  • Prettier, linting, and automatic tests pass without error or changes.

Copy link
Contributor Author

@mahoneycm mahoneycm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big footer accordion links

In it's current state, this PR removes the hover state underline from big footer accordion links. This matches default accordion behavior but is a change from styles on develop

Flagging to see if I should update to maintain this underline

image

Comment on lines -99 to -102
&:hover {
text-decoration: underline;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Styles redundant due to primary links having an underline in default states now

Comment on lines -169 to -173
@include u-text("ink", "no-underline");

&:hover {
text-decoration: underline;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional styles redundant due to primary links having an underline in default states now

.usa-footer__primary-link {
@include u-padding-x($theme-site-margins-mobile-width);
@include u-padding-y(2);
@include u-text("ink", "no-underline", "bold");
@include u-text("ink", "bold");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing no-underline from u-text() mixin properly applies color and weight without causing any unintentional regressions.

Copy link
Contributor

@thisisdano thisisdano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple and effective

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

USWDS - Bug: The footer's contact info links aren't a11y-compliant
2 participants