[whatwg] Proposal for New Tag for UI Elements

Ian Hickson ian at hixie.ch
Mon Dec 10 20:36:34 PST 2007

On Mon, 23 Jan 2006, Samuel Sidler wrote:
> From reading the current HTML5 spec, it seems like there is a need for a 
> new tag designed specifically for indicating selection of UI elements. 
> For purposes of this email, I'm going to call it <x> (for lack of a 
> decent name at the moment).
> Currently, the spec recommends using <kbd><samp> for UI elements [1]. 
> This seems inappropriate given what the tags are described as for and 
> generally messy as far as structure goes. The new tag would allow UI 
> elements to be surrounded by <x> instead. Based on the sample in the 
> spec [1] the code would go from this:
> <p>To make George eat an apple, select
>     <kbd><kbd><samp>File</samp></kbd>|<kbd><samp>Eat Apple...</samp></kbd></kbd>
> </p>
> To this:
> <p>To make George eat an apple, select
>     <kbd><x>File</x>|<x>Eat Apple...</x></kbd>
> </p>
> While it still feels like an abuse of the <kbd> tag to nest other tags 
> in it, I can see the need. I would, however, suggest removing those 
> <kbd> tags and allowing <x> to work on its own.

While I agree with you in principle, I don't think we have enough need for 
this element that we can afford to add a new element. In fact, people have 
strongly argued for the removal of <kbd>, <samp>, <var>, and others 
already, adding yet another really seems like a bad idea.

The <kbd><samp> semantic is relatively cheap and harmless to define in the 
spec; adding a whole new element is much harder to justify.

> As an aside, I generally disagree with the nesting of the <kbd> tag as 
> described in the spec. This seems messy and structurally inappropriate. 
> (Isn't this what the <span> tag is for?) The sample given of...
> <p>To make George eat an apple, press
> <kbd><kbd>Shift</kbd>+<kbd>F3</kbd></kbd></p>
> ... is simply ugly and seems malformed. While I understand the need for 
> separating each key command, I disagree that it should be nested inside 
> the <kbd> tag. Again, maybe <span> is more appropriate here. I'm not 
> completely sure. However, I'm definitely unconvinced that nesting <kbd> 
> tags inside <kbd> tags is appropriate behavior.

Well <span> has no meaning. Why would <kbd> not be used for this? It means 
"user input", and here we are marking up user input. No?

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list