Reputation: 25
I am working on doing accessibility remediation to several websites based off WCAG 2.0 AA standards. These sites have quite a lot of links to PDFs. Here is a common example of what they have:
<a href="/assets/pdf/pdf-file.pdf" target=_blank">Get Blah Information</a>
Based on my best understanding of WCAG 2.0 AA principles, this links should have title
text added, becoming something like:
<a href="/assets/pdf/pdf-file.pdf" target=_blank" title="Opens PDF file in a new window">Get Blah Information</a>
My question is about this title
text. It only seems occasionally appropriate. Most browsers will open the target="_blank"
in a new tab, not a new window. Also, on mobile many devices will launch a native app to open the PDF. Some devices/browsers will actually download the file, depending on the settings. With all these considerations, is there a better, more universal title for these types of files?
Upvotes: 1
Views: 3176
Reputation: 4322
It's generally considered courteous to give people a heads-up that that what they are clicking on will not open up as a webpage.
In my organization, we require that PDF links (or any link pointing to a non-HTML document) needs to clearly annotate the file type in the anchor text.
Like this:
<a href="/assets/pdf/pdf-file.pdf">Get Blah Information (PDF)</a>
The title
attribute isn't consistently supported among screen-reader/browser combinations, so I wouldn't recommend depending on it to work.
Links to Non-HTML Resources https://webaim.org/techniques/hypertext/hypertext_links#non_html
Users should generally be alerted to links that lead to non-HTML resources, such as PDF files, Word files, PowerPoint files, and so on. However, there is some debate as to whether the content author or the browser should be the one to alert the user. The trouble is that none of the browsers or screen readers currently alert the user at all, so the debate is more theoretical than practical.
If you're opposed to putting the filetype in the anchor text, you could always use the aria-label
attribute to supplement the anchor text, or position the text off screen so that it's not visible to sighted users, although these solutions may be less accessible for users with limited-sight ability.
Upvotes: 3
Reputation: 713
I would avoid using the title
attribute in this case. There are several issues with its use, and it should be avoided in most cases. For example, screen reader software will often read the title attribute in addition to the text that is already in the link, thus reading redundant and potentially confusing text. The way that the title
attribute is handled is inconsistent across assistive technology. Read more about when to use and not use the title attribute.
Additionally, I would avoid describing the action that will take place. As you described, different technology/devices handle the link in different ways, and the user can even choose how to interact with the link (open in a new tab, etc). Instead, focus on describing the purpose of the link. Your first example: <a href="/assets/pdf/pdf-file.pdf" target=_blank">Get Blah Information</a>
is much better than the second.
Upvotes: 0