I believe your kbd example is incorrect. You suggest
> To save, press Ctrl + S. But the spec (both W3C and WHATWG) suggests that individual keys should be nested inside an outer tag: "When the kbd element is nested inside another kbd element, it represents an actual key or other single unit of input as appropriate for the input mechanism." Thus, the example should be: > To save, press Ctrl + S. Cite: https://w3c.github.io/html/textlevel-semantics.html#the-kbd-... On the face of it, this seems ridiculous. It's too verbose, the tag name is misleading, and if you actually use the correct markup on GitHub or StackOverflow, it will render incorrectly because both sites assume the standalone element represents physical keyboard buttons. On the other hand, what's the value in semantic markup if we don't adhere to its semantics? Practically speaking, I would be a happier person today if I hadn't read that part of the spec, and instead persisted on in blissful ignorance of the element's intended semantics. Thanks, specs.
> File|Eat Apple... Boy that's terrible. Edit: Oh, I missed that the example immediately following it is supposedly equivalent and only uses a single outer tag. I don't really understand then, if they're equivalent then what's the point of the defined semantics above?
1. ___ means "literal user input" 2. ___ means "this specific, atomic keypress" 3. ___ means "this specific, atomic button/action/menu item" So you can fall back to just using method 1, but it implies generic user input, inclusive of but not limited to keypresses. Thus, styling and treating a single kbd tag specifically like a keyboard button is still likely incorrect, since that precludes other semantically valid uses?
It remained more or less the same through HTML 4.01: "Indicates text to be entered by the user." The notion of using nested kbd tags to indicate literal keys appears to have been introduced by WHATWG when working on HTML5. ...I'll dig into this more and actually write a blog post about it. I'm this close to relaunching a proper blog.
Talking about common usage of the kbd tag is kind of difficult given that it's never been commonly used, but personally, this was the only thing I ever saw it used for.
I'd think a website like this should be opinionated and remove the tags that are useless or should be deprecated in a web 5.0 world (huhu) (great website btw)
> Practically speaking, I would be a happier person today if I hadn't read that part of the spec, and instead persisted on in blissful ignorance of the element's intended semantics. Thanks, specs.
Hear hear! I found this hilarious and speaking to a shared feeling about some specs. Of course, I kind of understand why these WTF elements make it into the specs. Maybe it's some stupid corner-case that the first implementor's code handled in an odd way because the code was simpler. Maybe there are other interactions that made it simpler to have this case be weird so that it would at least be consistent with that case. Most often, of course, it's because some vendor's code is a buggy mess of spaghetti code that can barely do the most basic stuff without falling over. We've all been there... ;)
How is this updated (manually or automatically from official specs)?
Call me paranoid, but I see this diverging from actual specs, then people googling for "html reference" finding it and thinking it is something official. The result would be another W3Schools disaster[1]. In my opinion, the official W3 specification pages are not that bad, and alternatively there's the simpler MDN with strong community support (thus lower risk of deprecation). [1]: http://www.w3fools.com/
Comments (93) 42 threads
Same thing but guaranteed to be up to date and (more) complete.
For example, htmlreference.io's page for doesn't mention the autocomplete attribute. MDN lists all its possible values.
http://htmlreference.io/element/input/
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/in...
https://meiert.com/en/indices/html-elements/ - another nice minimalist project with great value.
> To save, press Ctrl + S.
But the spec (both W3C and WHATWG) suggests that individual keys should be nested inside an outer tag: "When the kbd element is nested inside another kbd element, it represents an actual key or other single unit of input as appropriate for the input mechanism."
Thus, the example should be:
> To save, press Ctrl + S.
Cite: https://w3c.github.io/html/textlevel-semantics.html#the-kbd-...
On the face of it, this seems ridiculous. It's too verbose, the tag name is misleading, and if you actually use the correct markup on GitHub or StackOverflow, it will render incorrectly because both sites assume the standalone element represents physical keyboard buttons.
On the other hand, what's the value in semantic markup if we don't adhere to its semantics?
Practically speaking, I would be a happier person today if I hadn't read that part of the spec, and instead persisted on in blissful ignorance of the element's intended semantics. Thanks, specs.
> File|Eat Apple...
Boy that's terrible.
Edit: Oh, I missed that the example immediately following it is supposedly equivalent and only uses a single outer tag. I don't really understand then, if they're equivalent then what's the point of the defined semantics above?
1. ___ means "literal user input"
2. ___ means "this specific, atomic keypress"
3. ___ means "this specific, atomic button/action/menu item"
So you can fall back to just using method 1, but it implies generic user input, inclusive of but not limited to keypresses. Thus, styling and treating a single kbd tag specifically like a keyboard button is still likely incorrect, since that precludes other semantically valid uses?
> Such precision isn’t necessary; the following is equally fine: >
To make George eat an apple, select File | Eat Apple...
It remained more or less the same through HTML 4.01: "Indicates text to be entered by the user."
The notion of using nested kbd tags to indicate literal keys appears to have been introduced by WHATWG when working on HTML5.
...I'll dig into this more and actually write a blog post about it. I'm this close to relaunching a proper blog.
Did that follow common usage at the time?
already exists :/?I'd think a website like this should be opinionated and remove the tags that are useless or should be deprecated in a web 5.0 world (huhu)
(great website btw)
already exists :/?Because keyboard input doesn't always mean code?
Well speak for yourself ;)
Continue this thread — 2 replies
Hear hear! I found this hilarious and speaking to a shared feeling about some specs.
Of course, I kind of understand why these WTF elements make it into the specs. Maybe it's some stupid corner-case that the first implementor's code handled in an odd way because the code was simpler. Maybe there are other interactions that made it simpler to have this case be weird so that it would at least be consistent with that case. Most often, of course, it's because some vendor's code is a buggy mess of spaghetti code that can barely do the most basic stuff without falling over.
We've all been there... ;)
Call me paranoid, but I see this diverging from actual specs, then people googling for "html reference" finding it and thinking it is something official. The result would be another W3Schools disaster[1].
In my opinion, the official W3 specification pages are not that bad, and alternatively there's the simpler MDN with strong community support (thus lower risk of deprecation).
[1]: http://www.w3fools.com/
http://docs.webplatform.org/wiki/Main_Page
[1]: https://github.com/jgthms/html-reference
[2]: http://cssreference.io/
For example the description for
is:
All comments shown.
Couldn't load more comments. Check your connection and try again.