Skip to content

Bug: Support command event #32478

@o-t-w

Description

@o-t-w

command and commandfor attributes were recently added to the HTML spec, along with a new command event. This is supported in Chrome/Edge since version 135, Firefox 144 and Safari 26.2. See MDN for a list of the valid commands - the command event should fire for all these commands.

React version: 19

Steps To Reproduce

  1. Include the following markup
    <button command="toggle-popover" commandfor="popover">Toggle popover</button>
    <div onCommand={handleCommand} popover="auto" id="popover">popover content</div>
  1. Define the handleCommand function
  function handleCommand(event) {
      console.log(`a command happened: ${event.command}`);
  }
  1. Open in Chrome or Edge and look at the browser dev tools console.

Link to code example: https://codesandbox.io/p/sandbox/distracted-lucy-vlh25y

The current behavior

Errors with the message: "Unknown event handler property onCommand. It will be ignored."

The expected behavior

The command event triggers the event handler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions