[whatwg] Proposal for New Tag for UI Elements

Krzysztof Żelechowski giecrilj at stegny.2a.pl
Tue Dec 11 09:03:21 PST 2007


Dnia 11-12-2007, Wt o godzinie 04:36 +0000, Ian Hickson pisze:
> 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?
> 

The + sign does not belong to the user input, it is a shortcut the
following explanation: 
<OL ><LI >press <KBD >Shift</KBD 
><LI >press <KBD >F3</KBD ><LI >release<KBD >F3</KBD 
><LI >release<KBD >Shift</KBD ></OL >

(That is how I have to explain it to my mom; otherwise she always gets
it wrong.)  So the + sign is actually misleading and certainly does not
belong to the KBD tag.

Think about printed instructions that show the keys boxed.  Would you
want to get the + sign boxed as well?

Chris




More information about the whatwg mailing list