react: Bug: Popover API not supported
About this API: https://developer.mozilla.org/en-US/docs/Web/API/Popover_API
React version: any
Steps To Reproduce
<div popover id="my-popover">
Greetings, one and all!
</div>
<button popovertarget="my-popover" popovertargetaction="show">
Open Popover
</button>
<input
type="button"
popovertarget="my-popover"
popovertargetaction="hide"
value="Close Popover"
/>
Link to code example: https://codesandbox.io/s/popover-api-8x5nfq?file=/src/App.js
The current behavior
-
Error in console:
Warning: Received
truefor a non-boolean attributepopover. -
popoverattribute wasn’t added todiv
It works if I change boolean atribute popover to popover="yes".
Also ESLint fails on unknown popover, popovertarget, popovertargetaction attributes.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 16
- Comments: 16 (2 by maintainers)
Is there any change the Popover API can be backported to v18?
Why isn’t this added to 18 too? Popover is available in all modern browsers and part of the standard
Tried to use
popovertoday. Doesn’t work. Have to explicitly set a value despite the spec defining “auto” as default.Honest question: What is the React team’s plan to permanently fix this so developers can trust React will always comply with web standards?
Popover is another example among many throughout the years where React’s non-compliance creates friction or outright fails to work with web standards. React has effectively recreated the situation we had with IE where one player with the biggest marketshare slows the whole community down. This is intolerable and not sustainable.
Will React18 also support popover api?
Just need to bring this up internally so that we’re aligned on prop naming. If anybody wants to test it out, you can install
to test https://github.com/facebook/react/pull/27981
@jfbrennan if you use the latest react RC, all popover API attributes and event handlers are available and working. i’m using
Hey folks! Any news on this?
A reliable polyfill is available for the Popover API, and some companies (eg. Github) are already using it in production. I tried using it in my app and spent 10 minutes trying to understand what I was doing wrong, before realizing that React itself didn’t support it. I think this sort of confusion will only get more common as this API gets more attention.
Just wanted to share this experience since I know it can be hard to gauge the importance of different issues. Appreciate the work y’all do! ❤️