interop icon indicating copy to clipboard operation
interop copied to clipboard

Invoker API

Open stof opened this issue 5 months ago • 9 comments

Description

The Invoker API (the command and commandfor HTML attributes) allows to trigger commands (opening a dialog, showing a popover, etc...) using a <button> in a declarative way.

It is shipped in Chromium-based browsers but not yet in Firefox and Safari

Specification

https://html.spec.whatwg.org/multipage/form-elements.html#dom-button-command

web-feature

invoker-commands

Test Links

html/semantics/the-button-element/command-and-commandfor html/semantics/popovers/popover-light-dismiss-command

Additional Signals

https://github.com/mozilla/standards-positions/issues/902 https://github.com/WebKit/standards-positions/issues/264

stof avatar Sep 04 '25 20:09 stof

This comment was automatically generated based on the information you provided. Please don't edit it.

Below is additional information about the web feature (from the web-features project) which is referenced in your proposal.
If this doesn't accurately correspond to your proposal, please update your initial comment to include web-features: <feature-id>. To find feature IDs, use the web-features explorer.

Feature Invoker commands

  • ID: invoker-commands
  • Name: Invoker commands
  • Description: The command and commandfor attributes for the <button> HTML element dispatch an action to an element when the button is invoked (by click or keystroke), as a declarative alternative to addEventListener() calls or onclick attribute handlers.
  • Baseline status: Limited Availability
  • Docs: Invoker Commands API
  • More information: See the web-features explorer

github-actions[bot] avatar Sep 04 '25 20:09 github-actions[bot]

This feature is already implemented in Firefox Nightly and Safari Technology Preview so probably does not need to be part of Interop 2026 unless there are known bugs or inconsistencies between browsers.

o-t-w avatar Sep 04 '25 20:09 o-t-w

This feature is already implemented in Firefox Nightly and Safari Technology Preview so probably does not need to be part of Interop 2026.

Looks like both firefox nightly and safari tech preview are both failing tests:

https://wpt.fyi/results/html/semantics?label=master&label=experimental&aligned&q=invoker

Since the feature doesn't have full support, I'd say it should be a part of interop 2026.

spartanatreyu avatar Sep 05 '25 02:09 spartanatreyu

Thank you @stof for submitting this proposal! I took the liberty of editing your description to link to wpt.fyi, I hope those are the tests you were intending to point at.

foolip avatar Sep 05 '25 07:09 foolip

@foolip yes, indeed

stof avatar Sep 05 '25 07:09 stof

Note that tentative tests aren't suitable for Interop, so a better test link is https://wpt.fyi/results/html/semantics/the-button-element/command-and-commandfor?label=master&label=experimental&aligned&q=%21is%3Atentative (if there are tests marked as tentative where there is in fact now agreement on the desired behaviour they need to be updated before the proposals are assessed).

jgraham avatar Sep 05 '25 09:09 jgraham

Additional to the tests mentioned in OP there's also:

Of the non tentative tests the only ones that will still potentially have partial failures in Safari (once the 227 test runs upload) will be some of these focus ones but it's distinct from the actual command/commandfor and is more related to popovers. It's possible that popover focus behaviour should be an interop proposal on its own,

Firefox similarly might have some failures of this sort but some of them are even in-progress with fixes.

lukewarlow avatar Sep 05 '25 10:09 lukewarlow

I don't think we should call this "Invoker API". That's a name we moved away from in standards.

annevk avatar Nov 19 '25 08:11 annevk

The name of the feature in the web-features project is still invoker-commands, which is why I used "Invoker API" when submitting it. I'm fine with any name for that scope though.

stof avatar Nov 19 '25 11:11 stof