Examples
React
Review Storybook for React guidance of this component.
Guidance
Use this pattern when the user is in the middle of a task or application to let them know that the action they are taking will move them away from the current site and or process. This serves as a warning where the user can then decide to remain where they are in the application or process.
Any PDF link, whether internal or external, is not a use case for using the third-party link component.
- PDF links should use the regular link style.
- Add "(PDF)" at the end of link.
Any non .gov and .mil links will be treated as external whether they belong to a government agency or not, no exceptions.
Accessibility
Accessibility
- Ensure that external links have unique, descriptive text—avoiding repetitive phrases like "read more"—and, if necessary, include appropriate ARIA labels to provide additional context for screen reader users.
- Clicking a third-party external link will initiate a modal dialog notifying users that they are leaving a CMS website. Please reference the Modal Dialog for further accessibility guidance.
Accessibility testing
General accessibility testing
- Regularly verify that third-party external links remain up-to-date.
- Ensure that external links point to secure (HTTPS) websites to protect user data and privacy.
- Test that third-party external links open in new tabs/windows.
Keyboard testing
- Users should be able to navigate between links with a keyboard by using the “Tab” key.
- Users should be able to activate a link by pressing the “Enter” key.
- Users should be able to activate hover and focus states with a keyboard.
Screen reader testing
- Use screen readers (e.g., NVDA, JAWS, VoiceOver) to verify that external link indicators are announced appropriately.
- Screen readers must explicitly mention "external link" or "opens in a new window" within the link text to alert users they are leaving the current site.
Code
Analytics
This component has analytics tracking available. Please see our developer documentation about using analytics in the design system.