Skip to content
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

Make private links more consistent across experiences #3637

Merged
merged 4 commits into from
Jun 26, 2023

Conversation

mgwalker
Copy link
Contributor

@mgwalker mgwalker commented Jun 23, 2023

Changes proposed in this pull request:

Currently the Handbook marks private links (Google Docs, Slack, etc.) by adding the private-link CSS class, which uses the ::after selector to add a padlock emoji, and setting the title attribute to "This link is private to TTS." However, as noted in #3543, this isn't a very friendly experience for people using screen readers. They are read something like this:

Link, Hiring Manager Guide, closed lock. This link is private to TTS.

This PR implements the guidance developed by the 18F Guides and Methods team in 18F/ux-guide#340:

  • ditches the private-link class entirely
  • a span node that is only visible to screen readers is inserted before the link with the text "TTS only"
  • an SVG node that is hidden from screen readers is inserted after the link with a reference to the USWDS lock_outline icon

When a screen reader lands on a private link, it now reads something more like:

Link, TTS-only, Hiring Manager Guide.

In addition to private links, this PR also adds identification to external links. Any links out of gsa.gov will be marked external. Screen readers will announce that they are external and an icon is shown to sighted users. The screen reader announces something like this:

Link, external, Airtable

This also works with private links:

Link, external, TTS-only, Hiring Manager Guide

Visually, they end up looking like this:
Screen Shot 2023-06-23 at 4 43 29 PM

Closes #3543

security considerations

None

@mgwalker mgwalker requested a review from a team as a code owner June 23, 2023 18:16
}

// For any links to outside of gsa.gov, identify them as external.
if (!url.hostname.endsWith("gsa.gov")) {

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization

'[gsa.gov](1)' may be preceded by an arbitrary host name.
Copy link
Contributor

@jskinne3 jskinne3 left a comment

Choose a reason for hiding this comment

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

This looks good and I agree Joe is real

@mgwalker mgwalker merged commit 9af5b85 into main Jun 26, 2023
@mgwalker mgwalker deleted the mgwalker/3543-a11y-private-links branch June 26, 2023 16:12
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.

Accessible external gsa-links
3 participants