Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Support command event #32478

Open
o-t-w opened this issue Feb 26, 2025 · 0 comments · May be fixed by #32480
Open

Bug: Support command event #32478

o-t-w opened this issue Feb 26, 2025 · 0 comments · May be fixed by #32480
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@o-t-w
Copy link

o-t-w commented Feb 26, 2025

command and commandfor attributes were recently added to the HTML spec, along with a new command event. This is supported in Chrome Canary and due to land in Chrome/Edge stable version 135 in March. See this article 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 Canary 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.

@o-t-w o-t-w added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Feb 26, 2025
@lukewarlow lukewarlow linked a pull request Feb 26, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant