Implementing HTML5 <details>

, ,

At Opera HQ, we're implementing the HTML5 <details> element. It's a groovy interactive element that functions as "a disclosure widget from which the user can obtain additional information or controls".

Most browsers will implement it as an expando box: when the user clicks on some browser-generated icon (such as a a triangle or down arrow) or the word "details" - which can be replaced by an author supplying their own rubric in a child <summary> element - the element will slide open revealing some further details inside. These could be a full description of an image or graph; a description of a complex table structure; advanced options for a search form; or just about anything else, and wouldn't need JavaScript to function.

It is vital that browsers implement HTML interoperably. So Opera's Lachlan Hunt has written to the WHATWG (the group speccing HTML5 with the W3C) to detail how Opera is implementing it, in the hope of getting feedback from developers, other browser vendors and (we hope) encouraging vendors to share information and implement similarly.

Our main aims in implementing <details> are:

  • The disclosure triangle must be styleable by authors using CSS without complex hacks, either to replace with their own icon, remove it entirely, or adjust other common styles. Ditto with <summary>: we cannot require, nor expect, authors to use XBL to restyle these elements.
  • Styles we use internally in the shadow tree shouldn't do weird things to author styles or surrounding content. Generally, the way that authors style the element and users interact with it should be simple and not contain any nasty surprises.
  • Accessibility: The summary element must be focussable by default and keyboard activation must be possible.
  • Internationalisation: The disclosure triangle and any applicable margins and padding must render on the opposite side and point the opposite direction for RTL languages.
  • We should reuse as much existing CSS styles as possible to achieve the effects, avoiding unnecessary creation of special properties or values without a good reason.

(I've summarised and paraphrased Lachy's fuller explanation.)

So: if you're a web author or an implementor, please read the email and respond on the WHATWG list (anyone can join).

Hurray for open discussion that leads to an interoperable Web! (But please, do it on the mailing list and not here!)

Opera and Grameenphone in BangladeshOptimize your site for the all new Speed Dial

Comments

Xombiemubaidr Wednesday, April 6, 2011 8:20:57 AM

up

Cutting Spoonhellspork Wednesday, April 6, 2011 3:54:23 PM

Hoping for a good result.

EDIT: I think the padding issue mentioned in that email is highly relevant. It would be especially bad on an 800x480 portrait screen layout. Are they paying *any* attention to the needs of mobile hardware?

Unregistered user Wednesday, April 6, 2011 8:32:34 PM

MadsenFr writes: You can already test it here (http://html5demo.braincracking.org/demo/details.php) and it works with Chrome 12.0.726.0.

Unregistered user Monday, May 16, 2011 2:48:46 PM

Anonymous writes: "The disclosure triangle must be styleable by authors" I am far from convinced of that - generally speaking browser chrome should NOT by stylable, eg scroll-bars, select-boxes, spin-buttons...

Cutting Spoonhellspork Monday, May 16, 2011 4:23:14 PM

For the most part browser chrome should of course be the domain of skinning. An option to style scollbars in-page could be fine though. It's still fine for extensions to add features as long as they honor the skin.

Write a comment

New comments have been disabled for this post.