custom-elements-everywhere icon indicating copy to clipboard operation
custom-elements-everywhere copied to clipboard

Add custom element with method

Open mrginglymus opened this issue 11 months ago • 3 comments

React 19 has a very naïve heuristic for setting props vs attributes; if it detects a property on the custom element with the same name as the attribute, it sets it as a property. This doesn't work if you have a method on the custom element with the same name as an attribute you are trying to set.

  • https://github.com/facebook/react/issues/31689

I've attempted to provide a reproduction here; unfortunately this repository does not behave well on Windows or WSL, which are currently my only two options. I will investigate adding support for Windows devs in another PR.

mrginglymus avatar Dec 08 '24 10:12 mrginglymus

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Dec 08 '24 10:12 google-cla[bot]

I'm a little confused to as to how I'm supposed to add a successfully failing test...

mrginglymus avatar Dec 16 '24 08:12 mrginglymus

This PR now includes tests for all currently supported frameworks. There are many that have now dropped from 100%, mostly I think those using JSX-like syntax. I've tried to check each one's documentation for hints as to how to set attrs rather than props.

mrginglymus avatar Dec 27 '24 18:12 mrginglymus

Are there any open issues for this new case?

There's at least facebook/react#31689 for React, but it's closed.

I've re-opened it. Is there somewhere in this repo we reference open issues for failing tests?

mrginglymus avatar Aug 06 '25 12:08 mrginglymus

If there's a chance that https://github.com/webcomponents/custom-elements-everywhere/pull/2474 might get merged soon, I'd rather that get merged before this - deconflicting this on top of that one will more pleasant than vice versa.

mrginglymus avatar Aug 07 '25 07:08 mrginglymus