HTML Concepts: Commands and Facets
Published on Mar 29, 2022 (updated Aug 17, 2024), filed under development (feed). (Share this on Mastodon or Bluesky?)
In the HTML concepts series I’m presenting lesser known ideas from the huge HTML specification. In this episode, let’s have a quick look at commands and facets.
Commands
Commands should be what you think they are. A command is defined as “the abstraction behind menu items, buttons, and links.” It’s what you issue when you interact with them, that is, click or press on either.
Accordingly,
- an
a
element with anhref
attribute defines a command; as does - a
button
element (“always”); - an
input
element whosetype
attribute is in a “Submit Button, Reset Button, Image Button, Button, Radio Button, or Checkbox” state; - an
option
element with an ancestorselect
element and either novalue
attribute, or one that is not the empty string; - a
legend
element that has an assigned access key, is a child of afieldset
element, and whose parent has a descendant that defines a command that is neither alabel
nor alegend
element; and - any element that has an assigned access key.
Facets
Facets are rarely mentioned anywhere; they are something a command has. There are the following facets:
- Label: the name of the command.
- Action: the effect of the command when triggered, like a URL to navigate to, a form submission, or an event handler.
- Access key (optional): a key combination selected by the user agent which triggers the command.
- Hidden state (optional): information on whether the respective command is hidden.
- Disabled state (optional): information on whether the respective command is relevant and can be triggered.
âť§ Commands are easy to work with, as they represent something actionable. Facets may be what you can now recall as something that specifies and gives information about a command. Review other concepts, and see you in a follow-up post of this series.
About Me
I’m Jens (long: Jens Oliver Meiert), and I’m a web developer, manager, and author. I’ve worked as a technical lead and engineering manager for small and large enterprises, I’m an occasional contributor to web standards (like HTML, CSS, WCAG), and I write and review books for O’Reilly and Frontend Dogma.
I love trying things, not only in web development and engineering management, but also in other areas like philosophy. Here on meiert.com I share some of my experiences and views. (I value you being critical, interpreting charitably, and giving feedback.)