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

Add support for command invokers API #32480

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lukewarlow
Copy link

Summary

Command Invokers are shipping in chrome soon and are now in the HTML spec, this adds support to React.

Fixes #32478

How did you test this change?

I've not yet the docs are out of date and refer to a UMD build that no longer exists.

@eps1lon
Copy link
Collaborator

eps1lon commented Feb 27, 2025

Awesome! Can you provide a fixture that illustrates their usage? You can use https://react.new/ and then specify builds from the ci/codesandbox check on this PR

@react-sizebot
Copy link

Comparing: ebc22ef...bddc211

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB +0.05% 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js +0.08% 515.73 kB 516.13 kB +0.08% 92.10 kB 92.17 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB +0.05% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js +0.07% 565.65 kB 566.06 kB +0.07% 100.87 kB 100.94 kB
facebook-www/ReactDOM-prod.classic.js +0.06% 636.71 kB 637.12 kB +0.06% 112.07 kB 112.15 kB
facebook-www/ReactDOM-prod.modern.js +0.07% 627.03 kB 627.44 kB +0.08% 110.48 kB 110.57 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 0cbf5db

@lukewarlow
Copy link
Author

lukewarlow commented Feb 27, 2025

https://codesandbox.io/p/sandbox/happy-wilbur-crtsz9 - So this will show the in-built commands work aswell as showing that custom ones work, but for some reason only onCommandCapture works, not onCommand?

I'm assuming I'm missing something in this PR to make onCommand work as expected. Though command events don't bubble so perhaps this is just due to React's synthetic events?

Btw this will only work in Chrome Canary with the experimental flag enabled right now. (It's shipping to stable 135)

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
4 participants