I don't want people to leave my site when they click on links. Can I configure these links so that they automatically open in a new tab?
Thank you for asking - this is a very common question, and something we encounter regularly during Web Access clinics, and when visiting websites in general!
The Web Access team doesn't recommend opening links in new tabs. For one thing, the World Wide Web Consortium (W3C) does not recommend this practice, as it takes the control out of the user's hands (opening a new tab without the user's consent).
Additionally, it's an accessibility best practice to not have links open automatically in a new tab/window, as this can cause confusion for screen reader users. I've regularly seen Lucy activate a link on a website that was configured to automatically open in a new tab, and she had no idea that it had opened! This practice can also cause confusion for users with certain cognitive disabilities.
Visitors without disabilities can always choose to open links in a new browser window or tab if they want to (e.g., right-click the link and select “Open Link in New Tab” or “Open Link in New Window”).
The WCAG 2.0 AA standards say to limit the amount of links/buttons that open in new tabs/windows. There are some allowed exceptions, and here is what WCAG says about that:
In general, it is better not to open new windows and tabs since they can be disorienting for people, especially people who have difficulty perceiving visual content. However there are some situations where it is preferable from an accessibility perspective to open a new window or tab. Here are two such situations:
- Opening a page containing context-sensitive information, such as help instructions, or an alternate means of completing a form, such as a calendar-based date picker, will significantly disrupt a multi-step workflow, such as filling in and submitting a form, if the page is opened in the same window or tab.
- The user is logged into a secured area of a site, and following a link to a page outside of the secured area would terminate the user's logon. In this case opening external links in an external window allows the user to access such references while keeping their login active in the original window.
It is recommended that when links are opened to a new window, there is advance warning.
But what if I really, really want my links to automatically open in a new tab?
Overall, we believe that not configuring links to automatically open in a new tab is a best practice for everyone! However, if it must happen, then the best way to proceed with configuring links that automatically open in a new tab is to provide both visual and verbal indication.
Visual indication is something like an external link icon appended at the end of the link, and the verbal indication would be invisible offscreen text that reads "external link opens in a new tab," or something similar. If an external link icon is used at the end of the link, the message of "external link opens in a new tab" could also be implemented as the alt text of the icon.
Here are some examples! Below is a screenshot of two links. The first link is an internal, and the second link is an external link. The external link has a link icon appended to the end, after the text of link.