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. This declarative approach allows developers to create interactive components without writing event listeners or waiting for JavaScript to download and execute, improving initial page interactivity.
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:
Popover content
The API also enables custom commands, which must be prefixed with two dashes, similar to CSS custom properties. Developers can listen for these commands using the command event and check the command name on the event object. This allows component authors to create declarative APIs for their web components without requiring consumers to write JavaScript.
A medium article described the API as the coolest API you aren’t using yet
and expressed enthusiasm that invokers let your buttons actually do stuff without JavaScript.
Developer Pawel Grzybek noted that every time the web ships new features that let us shift the implementation left on the stack, I’m excited about it
describing the API as moving the implementation of button click handlers upstream to the HTML
.
Elsewhere, CSS-Tricks observed that custom commands rely on event handler HTML attributes, noting this is maybe a bit (or definitely a lot) controversial since using event handler HTML attributes is considered bad practice
.
For developers currently using the popovertarget and popovertargetaction attributes, the Invoker Commands API provides a more unified approach. Popovers can now use either the existing popover-specific attributes or the new command and commandfor attributes, allowing gradual migration.
Compared to libraries like HTMX, which provide declarative controls through custom attributes, Invoker Commands offer similar functionality as a native platform feature. The Open UI explainer notes that whilst the initial release focuses on popovers and dialogs, support for additional elements such as
The Invoker Commands API is defined in the WHATWG HTML specification and represents a continued effort to reduce JavaScript dependencies for common interactive patterns. By enabling developers to create interactive components declaratively, the API improves both developer experience and user experience through faster initial page loads and more accessible markup.
