[Link] Warn the user if a link opens in new window #2898
Description
Feature Request
Is your feature request related to a problem? Please describe.
All links must operate in predictable ways (WCAG 3.2) - Open new browser tabs or windows are considered context changes, and should not occurs without telling the user (WCAG 3.2.5)
Currently, users don’t have a visual warning on external links telling they will open a new tab/window
Describe the solution you'd like
Add a visual warning on all external links with target="_blank".
The solution I recommend is to add the suffix "- new window" to the end of each title attribute
In the code, edit "PN_LINK_TITLE_ATTRIBUTE" around line 130 of aem-core-wcm-components/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/link/LinkBuilderImpl.java
Example 1
<a href="target_page_url" target="_blank" title="My label - new window">My label</a>
Are there alternatives?
I have also considered 2 others alternatives :
First one is to add an icon with an hidden text with .sr-only class (to hide an element except for screen readers) to every link with target="_blank".
Example 2
<a href="target_page_url" target="_blank">My label<img src="external_link.svg" alt=""> <span class=”sr_only”>opens in new window</span></a>
Second alternative is to automatically add an icon with an alternative text to every link with target="_blank".
Example 3
<a href="target_page_url" target="_blank">My label<img src="external_link.svg" alt="opens in new window"></a>
Documentation
- WCAG 3.2 : https://www.w3.org/TR/WCAG21/#predictable
- WCAG 3.2.5 : https://www.w3.org/TR/WCAG21/#change-on-request
- WCAG G201 : https://www.w3.org/TR/WCAG20-TECHS/G201.html
- WCAG F22 : https://www.w3.org/WAI/WCAG21/Techniques/failures/F22