[whatwg] Proposal for New Tag for UI Elements

Samuel Sidler i at samuelsidler.com
Mon Jan 23 23:13:07 PST 2006

>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>

To this:

<p>To make George eat an apple, select
    <kbd><x>File</x>|<x>Eat Apple...</x></kbd>

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.

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

... 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.

Thank you for your time,

Samuel Sidler

[1] http://whatwg.org/specs/web-apps/current-work/#kbd0

More information about the whatwg mailing list