W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2007

[whatwg] Usefulness of nested <kbd>/<samp>

From: Simon Pieters <zcorpan@gmail.com>
Date: Sun, 24 Jun 2007 23:13:19 +0200
Message-ID: <op.tuf2khua7a8kvn@hp-a0a83fcd39d2>
The spec suggests that <kbd> and <samp> elements can be nested in  
different ways to represent different things.

    http://www.whatwg.org/specs/web-apps/current-work/multipage/section-phrase.html#the-kbd

This was discussed on IRC:

    http://krijnhoetmer.nl/irc-logs/whatwg/20070615#l-294


Summary:

  * UAs can't do anything useful with the information.

  * The reader can understand the intent by the context.

  * A single level of either <kbd> or <samp> is enough for common styling
    needs. Even if it isn't, a class on the outermost element is more
    helpful due to lack of parent selectors in CSS.

  * It's extremely verbose. Compare:

      <kbd>File</kbd> > <kbd>Exit</kbd>

    ...with:

      <kbd><kbd><samp>File</samp></kbd> > <kbd><samp>Exit</samp></kbd></kbd>

  * Fiddly markup inevitably causes confusion and is easier to get wrong.

  * People can nest the elements if they like (e.g. for more complex
    styling) without this being required. An example might be a page that
    contains both text to be entered and keys to be pressed, with those
    being styled differently.

  * <kbd> is already used in the wild to represent keys to be pressed.

-- 
Simon Pieters
Received on Sunday, 24 June 2007 14:13:19 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:56 UTC