
"The HTML Invoker Commands API has achieved baseline support across all major browsers, with Safari 26.2 completing the rollout following earlier releases in Chrome 135 and Firefox 144. The feature introduces declarative button controls that eliminate the need for JavaScript when working with popovers, dialogs, and other interactive elements. The Invoker Commands API adds two new attributes to button elements: commandfor and command. The commandfor attribute takes the ID of the element to control, whilst command specifies the action to perform."
"Built-in commands support common operations for popovers and dialogs. For popovers, developers can use toggle-popover, show-popover, and hide-popover commands. Dialogs support show-modal and close commands. An example of a declarative popover implementation is shown below: <button commandfor="mypopover" command="toggle-popover"> Toggle the popover </button> <div id="mypopover" popover> <button commandfor="mypopover" command="hide-popover">Close</button> Popover content </div> The API also enables custom commands, which must be prefixed with two dashes, similar to CSS custom properties."
The HTML Invoker Commands API is now supported across major browsers including Chrome 135, Firefox 144, and Safari 26.2. The API adds commandfor and command attributes to button elements so buttons can declaratively target and invoke actions on elements by ID. Built-in commands provide toggle-popover, show-popover, hide-popover, show-modal, and close behaviors for popovers and dialogs. Declarative invokers remove the need for event listeners and allow interactive UI to work before JavaScript loads, improving initial page interactivity. The API also supports custom commands prefixed with -- and dispatches a command event developers can handle to implement component-specific behavior.
Read at InfoQ
Unable to calculate read time
Collection
[
|
...
]