HTML Concepts: Commands and Facets
Published on Mar 29, 2022 (updated Aug 17, 2024), filed under development, html. (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
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 a web developer, manager, and author. I’ve been working as a technical lead and engineering manager for companies you’ve never heard of and companies you use every day, 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.)
