-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
React DOM: Add support for Popover API #27981
Conversation
Comparing: 1d6eebf...0850281 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
@eps1lon first of all, can’t wait for this to land! the browser console and linting errors are distracting and painful. i asked this on the previous PR but never heard a reply, so trying again here: do you know how much of a lift it would be to extend support to include the new toggle and beforetoggle events associated with the Popover API? |
83e9e4f
to
b314e08
Compare
@acusti Thank you for raising this. These events should be part of this PR. I'll add some tests. |
82ce4f9
to
28f640d
Compare
28f640d
to
4def45c
Compare
@eps1lon i just tried out this build (based on your instructions, thank you) and it’s looking great! way better to be able to use one thing i noticed is that the i will be using this build and will report if anything else comes up, but based on using it so far, i’m very excited for this support to land. and for anyone following this PR, you can try out the builds from this PR by installing
UPDATE see below for latest dependency strings |
Will this be part of react 19? |
83bcaab
to
29b66a5
Compare
@acusti Good catch, thank you. Should work with the latest version of this branch: https://codesandbox.io/p/github/eps1lon/react-popover-api-demo/main |
@eps1lon i just tried it out using the dependency strings from your codesandbox and the toggle event
UPDATE see below for latest dependency strings |
@eps1lon is attempting to deploy a commit to the Meta Open Source Team on Vercel. A member of the Team first needs to authorize it. |
We decided to go with |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This reverts commit b394c00.
dependency strings for those who want to try out the latest version of support (rebased off of latest
|
I'm highly interested in this feature. Is it worth to wait, because it will just take a few days till a new release or...? No idea about the release process of React. But I really wanna use this in combination with a polyfill where needed. Would be a bummer if that's not possible. 😕 |
@weilbith if you use the latest react RC, all popover API attributes and event handlers are available and working. i'm using the following versions (prepend the code with
@mariusGundersen yes! it's landed in the latest react v19 RC as of the version string above. |
one last note for @weilbith and @mariusGundersen and anyone else trying to use React’s popover API support in a typescript project. you will need to use the latest version of |
Is there any change the Popover API can be backported to v18? |
Summary
Closes #27479
Alternate to #27480
This includes support for
popover
,popoverTarget
,popoverTargetAction
,onToggle
andonBeforeToggle
. The events are only triggered for elements that have apopover
prop matching the spec.The Popover API is currently supported in all major browsers (Chrome, Safari, Firefox)
We decided to go with
popoverTarget
instead ofpopoverTargetElement
for the prop naming sincepopoverTarget
takes string just likepopovertarget
does.popoverTargetElement
reads and writesHTMLElement
.popoverTarget={object}
will warn unlike other props since we'll overload this prop to accept DOM Elements in the future.How did you test this change?