The world according to nouns

WCAG 2.0 – when I want beer, don’t give me shandy. Excellent write-up of the new web accessibility guidelines by Bruce Lawson, prompting me to write:

I had some thoughts on semantic HTML and Ajax (basically – HTML is a markup language for text documents. Does it have any semantic meaning when you start using it to mark up application user interfaces?)

Patrick Lauke pointed out, quite rightly, that HTML is the only language understood by existing user agents, so we’re stuck with it anyway. He started a discussion on accessify forum but I thought it might be helpful (for me at least) if I expanded on what my original thoughts were.

HTML is a fairly simple, generic markup language that was invented by high-energy physics geeks so that they could share dry academic papers that noone really reads anyway. As such, it contains tags describing structural elements of documents such as nested headings, paragraphs, various types of lists and quotations.This is what makes the web so powerful – anyone can quickly grasp the basics of HTML and use it to mark-up and publish a web page without much by way of specialist technical knowledge.

We all want our HTML documents to be accessible to the widest range of web browsing software. To this end, we should be using HTML as a descriptive markup language, rather than a presentational markup language ie. our markup should be telling people what the different parts of our documents are (headings, paragraphs, lists etc.) not what they look like (indented, larger typeface, italicised etc.)

For this reason, advice on publishing accessible web pages tends to talk about semantic markup – markup which describes the meaning of a piece of content, rather than its appearance on the page. Fair enough, but what if you have a web page which isn’t made up of the relatively simple structural elements contained in HTML?

We’re seeing the appearance on the web now of complex pages (or applications, even) such as Google Maps. Semantic elements to describe things like the Google Maps magnification slider don’t really exist in HTML. We could use the generic <div> element to markup these parts of our user interfaces, which lie outside the range of elements defined by HTML, but that doesn’t do much for users of screenreaders, for example. The div element is so generic as to be practically useless in assigning meaning to a part of the page.

I think, and this is purely my opinion, that when you mark up a page in HTML you shouldn’t get too hung up on the semantic meaning of the elements. HTML is not really a semantic markup language. What you should be concerned about (and if you’re not someone should open a big can of standards-based whoop-ass on your presentational-code-loving butt) is describing your page elements in such a way as to make them easier to use by screen readers, keyboard-based browsers etc. For example, don’t ask ‘is this set of elements really an unordered list?’ but do ask ‘if I mark up this set of elements as an unordered list, does that make my page more accessible and easier to use?’

I’m probably splitting hairs on the difference between descriptive and semantic markup, and may well be talking complete bollocks. I’d be interested in your thoughts…