Skip to content

USWDS - Links: External link labels #5166

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

Merged
merged 16 commits into from
May 10, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix formatting, add period
  • Loading branch information
James Mejia committed Apr 7, 2023
commit 8e233497fafcbccf964631af54db3df11040a71a
6 changes: 4 additions & 2 deletions packages/usa-link/src/usa-link.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

<p>This is <a class="usa-link usa-color-text-visited" href="javascript:void(0);">a visited link</a>.</p>

<p>This is a link that opens in <em>current</em> tab and goes to an <a class="usa-link usa-link--external" href="https://i.giphy.com/media/WPzQF6ruiIIVzHNlwX/source.gif">external website</a>.</p>
<p>
This is a link that opens in <em>current</em> tab and goes to an <a class="usa-link usa-link--external" href="https://i.giphy.com/media/WPzQF6ruiIIVzHNlwX/source.gif">external website</a>.
Copy link
Contributor

Choose a reason for hiding this comment

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

No action needed, just noting that opening source.gif is still a surprise every time

Choose a reason for hiding this comment

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

Now that @amyleadem mentions it yes, it does say "link" twice (which is tricky to discern since some of the links say "link" in them.

Additionally, I hear JAWS trying to say the word "tab" which runs into the phrase "external website" both in ANDI and in JAWS. I'm attaching how it looks in ANDI so you can get an idea of how it sounds. Like a run-on sentence.

external link text

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@amycole501 @amyleadem I've added the following changes:

  • Simplified the CSS
  • Removed the base variable $theme-external-link-sr-label.
  • Added punctuation to the label ex: "External, opens in a new tab." to prevent screen readers from jumbling the words together.

</p>

<p>
This is a link that opens in a <em>new</em> tab and goes to an <a class="usa-link usa-link--external" rel="noreferrer noopener" target="_blank" href="https://i.giphy.com/media/WPzQF6ruiIIVzHNlwX/source.gif">external website</a>
This is a link that opens in a <em>new</em> tab and goes to an <a class="usa-link usa-link--external" rel="noreferrer noopener" target="_blank" href="https://i.giphy.com/media/WPzQF6ruiIIVzHNlwX/source.gif">external website</a>.
Copy link
Contributor Author

@mejiaj mejiaj Apr 7, 2023

Choose a reason for hiding this comment

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

I've explicitly added rel="noreferrer noopener" as a best practice; even though most modern browsers implicitly add it.

image
MDN Browser compatibility →

Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is a best practice, would it be beneficial to include guidance on noreferrer noopener in the documentation?

Copy link
Contributor Author

@mejiaj mejiaj Apr 10, 2023

Choose a reason for hiding this comment

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

I've kept noreferrer since only one is needed in [e348c59], but it might not be needed at all since modern browsers add it implicitly.

Either way, I've added it in guidance on site:
uswds/uswds-site#2056

</p>

<div class="usa-dark-background padding-1 display-inline-block">
Expand Down