Skip to content

React DOM: Add support for Invoker Commands API#36493

Open
MaxwellCohen wants to merge 2 commits into
facebook:mainfrom
MaxwellCohen:feat/invoker-command-api
Open

React DOM: Add support for Invoker Commands API#36493
MaxwellCohen wants to merge 2 commits into
facebook:mainfrom
MaxwellCohen:feat/invoker-command-api

Conversation

@MaxwellCohen
Copy link
Copy Markdown

@MaxwellCohen MaxwellCohen commented May 19, 2026

Summary

This includes support for commandfor, command, and oncommand event. The events are only triggered by elements that match the invoker command API.

The Invoker Commands API is currently supported in all major browsers (Chrome, Safari, Firefox)

I designed this PR to match React DOM: Add support for Popover API #27981 as closely as possible, with as few changes as possible.

fixes: #32478

How did you test this change?

  1. Created tests, and all relevant tests passed (locally on node v20.19.0, but 1 unrelated snapshot fails on node v24.15.0 )
  2. Sandbox demo

Open Questions/Concerns

  1. I tried my best to place the invoker command code in the proper places in large relevant files; if they are not, please let me know so I can match coding standards.
  2. This is adding a new synthetic event. I want to make sure I am adding all necessary code, types, and other things to support React synthetic events. If I am missing something, please let me know so I can add it.
  3. What is the process for updating the definitely typed package for Rect to add support for Invoker Commands?

I leverage Composer 2.5 LLM to help me create this PR and reviewed every line

@meta-cla meta-cla Bot added the CLA Signed label May 19, 2026
This commit adds a new test case to verify that the commandFor attribute is correctly set on button elements. It ensures that the attribute is rendered as expected in the DOM. Additionally, it modifies the handling of the commandFor property in the ReactDOMComponent to allow for better error handling in development mode.
@MaxwellCohen MaxwellCohen marked this pull request as draft May 20, 2026 21:53
@MaxwellCohen MaxwellCohen marked this pull request as ready for review May 20, 2026 22:27
document.body.removeChild(element);
}
},
overrideStringValue: 'popover-target',
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am reusing 'popover-target' ID be because the common use case for the invoker API is popovers. If I should change it let me know.

@MaxwellCohen
Copy link
Copy Markdown
Author

@eps1lon or @rickhanlonii, this is ready for review. If you would be so kind, could you take a look at this PR?
If there are any changes or missing items, please let me know, so I can make them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Support command event

1 participant