HTML Concepts: Commands and Facets
Published on Mar 29, 2022 (updated Aug 17, 2024), filed under development, html. (Share this post, e.g., on Mastodon.)
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
aelement with anhrefattribute defines a command; as does - a
buttonelement (“always”); - an
inputelement whosetypeattribute is in a “Submit Button, Reset Button, Image Button, Button, Radio Button, or Checkbox” state; - an
optionelement with an ancestorselectelement and either novalueattribute, or one that is not the empty string; - a
legendelement that has an assigned access key, is a child of afieldsetelement, and whose parent has a descendant that defines a command that is neither alabelnor alegendelement; 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 an engineering lead, guerrilla philosopher, and indie publisher. I’ve worked as a technical lead and engineering manager at various companies (e.g., Google); I’m an active web and tool developer (code optimization, digital defense), a contributor to web standards (like HTML, CSS, WCAG), and a book author (O’Reilly, Frontend Dogma).
I love trying things—in web development and engineering management, but also in politics and philosophy, where I hold to one idea in particular: that we can only be well if we take good care of everyone. Here on meiert.com I talk about some of my perspectives and experiences. (Interpret charitably but be critical—and share feedback and advice that makes my work better.)
