Skip to main content

Day 42 of 100DaysOfSpec, 3.2.5 Global Attributes, contd.

I am reading and taking notes on the HTML specifications for 100 days as part of #The100DayProject. Read the initial intent/backstory. I am a Microsoft employee but all opinions, comments, etc on this site are my own. I do not speak on behalf of my employer, and thus no comments should be taken as representative of Microsoft's official opinion of the spec. Subsections not listed below were read without comment.

Currently reading in 3.2.5 Global Attributes

3.2.5.1 The id attribute

Other than being unique, at least one character, and devoid of spaces, "there are no other restrictions on what form an ID can take; in particular, IDs can consist of just digits, start with a digit, start with an underscore, consist of just punctuation, etc." A couple of surprises there. I've had a couple of cases in which I've had to prefix a classname with text so that styling wouldn't choke on a classname starting with a digit. Bless the poor souls who have to inherit IDs made entirely of punctuation.

"Particular meanings should not be derived from the value of the id attribute." Unsure what is meant here.

3.2.5.2 The title attribute

To be honest, I don't think I've ever used a title attribute on anything other than an image or anchor link. But as mentioned in the last post, it's chill to use it on any HTML element.

The spec warns not to rely on the title for anything important, due to accessibility problems. Chiefly not being able to trigger the title when interacting with keyboard or touch. But if we don't have finger-hover technology on consumer mobile devices within the next 5 years, I'll be shocked.

If an element doesn't have a title attribute set, the implication is that the nearest ancestral title also applies to this element. You would need to override with a title attribute on the item itself, even an empty string, in order to clear that implication. The title algorithm should actually return this, not just someone on an HTML working group being fussy about ~~meaning~~

You can force line breaks in titles, but "caution is advised". Well...why? Mileage may vary or it will actually break something? Who knows!

Responses

My blog uses Webmentions. Responses from Mastodon and other sites that send Webmentions will show up here.

No Webmentions have been sent to this post yet.