A link that opens a new window can surprise someone using a screen reader. Visually hidden text can give that person a warning while an icon provides a visual cue. Do not use `display:none` for the warning: it hides the text from everyone. section 5.4
<a href="/anotherpage" target="_blank"> Dog therapists in your area. <span class="visually-hidden">(opens in new window)</span> <img src="images/new-win.png" alt="" aria-hidden="true" class="new-win"> </a>
The link includes a visually hidden warning and a decorative icon. The icon has empty alternative text so it does not repeat the warning. section 5.4
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
border: 0;
overflow: hidden;
white-space: nowrap;
clip-path: inset(50%);
/*margin: -1px; <-- fallback for older browsers*/
}
The CSS reduces the warning to a clipped 1-pixel area while keeping it in the accessibility tree. section 5.4
An icon is useful only if sighted users understand it. When possible, put the warning in visible text instead: everyone gets the same cue, with less code. section 5.4
