(Last Updated on )
Now that the HTML5 spec is settling down, we’re seeing a resurgance of people attempting to cut good bits out. One of the latest targets is the very useful
<details> <summary>Get in touch</summary> <p>Interested in sponsoring? Get in touch.</p> </details>
If you click on the text inside the
summary element (which defaults to the text “details” if absent), the details element expands. Click again, and it contracts.
Anyway, the argument against this element is that it duplicates what you can do already with a
input type=range or
input type=date or even good old fashioned
textarea when you could have one single
input element and script everything else?
The answer is because it’s much more hassle to pull in script and keep role and state info with ARIA. It’s much better to build these things into the language, with built-in accessibility because the browser vendors bake in role and state information and hook up the widgets to the operating system.
Expecting developers to reinvent this wheel every time is “bolt-on” accessibility, and we all know that they won’t actually do it. Yes, they can use a library. I’ve seen the whole jQuery library pulled in just to make an expando box behave like
I refer you to John Foliot, whose email to the HTML Working Group makes an excellent argument that explains the subject much better than I can. I should add that Foliot is by no means an HTML5 cheerleader and is a great advocate of accessibility and ARIA. His main points are
- If something needs to be referenced you should normally make it an element, with an id attribute
- If something represents a separate entity, make it an element: you might want to add attributes later
- having a simple element express something instead of requiring a bunch of lines of scripting is way more efficient.
- moving functionality into the browser natively, instead of relying on scripting which requires additional CPU is an efficient design choice
- having ‘accessibility’ built-in rather than bolt-on (which is what ARIA is) is a fundamental desire of most of us in the a11y community.
I recommend you read the whole email and his blogpost Thoughts on <details> versus @summary .