21 December 2021

24 Accessibility: “The Trials and Tribulations of the Title Attribute”

The title attribute gets a lot of flack. And largely the disdain towards the attribute is quite justified.

In June of 1993, twenty-four and a half years ago, title was proposed as part of the HTML 1.2 draft. It is primarily displayed as a native tooltip in desktop browsers, and revealed when a user mouse hovers over markup elements the title is set to. Because of this, it has been a universal usability challenge since its inception, as not all users have been consistently able to interact with it.

If all of that weren’t enough, the guidance from the W3C HTML specification is pretty damning:

Relying on the title attribute is currently discouraged as many user agents do not expose the attribute in an accessible manner as required by this specification (e.g., requiring a pointing device such as a mouse to cause a tooltip to appear, which excludes keyboard-only users and touch-only users, such as anyone with a modern phone or tablet).

Scott O’Hara

An informative article, but the dismissive tone of the author towards a HTML attribute is misguided and reveals more about the state of web standards and development than the title attribute itself. In this particular case, a vicious cycle has been in effect from the start: most browsers never bothered to implement more accessible ways to reveal titles, so developers rarely used them, so browsers didn’t feel compelled to work on this feature, and so on. And when Internet Explorer 10 and later Microsoft Edge started displaying tooltips on focusable elements with titles during keyboard navigation, another common, but rarely acknowledged, bias in web development intervened: it’s almost fashionable to dismiss anything proposed or introduced by Microsoft, so no other browser considered following suit.

unsurprisingly, the author almost never properly used title in this entire article…

Even though it’s unavailable in mobile browsers, the title attribute remains the simplest way to provide tooltips in desktop browsers – consider it a form of progressive enhancement. In other words, while discarding title has no downside for mobile users, it removes a feature that enhances the desktop experience – which exposes another common failing of web development, where the practice of mobile-first design degenerates into mobile-only design. Instead of bitching around that an attribute is less useful than they expected, web developers should advocate with browsers to expand its scope. Standards bodies seems as ineffective in these situations as they are for privacy matters; without incentives to comply, browser vendors just work on their own projects, and the standards committee meekly rubberstamps whichever approach proves more popular overall.

YouTube iframe embed code

Personally, I use title extensively for links – I consider it a courtesy to my, admittedly few, readers, to reveal where a hyperlink leads more clearly. Lately, I have started to use the <abbr> element to markup lesser-known abbreviations, which also works in tandem with title. And, inspired by this article, I will take more care to add meaningful titles to <iframe> as well – I noticed that YouTube’s embed code uses a generic title by default, not very useful for screen readers.

Post a Comment