Custom element attribute handling differs from native elements causing runtime errors.
The issue reports inconsistent attribute handling between native elements and custom elements in React, specifically for 'form' and 'aria-invalid' attributes. The fix would require modifying React's attribute handling logic for custom elements to match native behavior. The main blocker is understanding React's internal attribute processing logic and potential impacts on custom element support.
The common/global HTML attributes are treated differently between native elements and Custom Elements. For example, <input aria-invalid={true}> in React produces <input aria-invalid="true"> in the HTML. But <custom-element aria-invalid={true}> in React produces <custom-element aria-invalid> in the HTML. This leads to an inconsistent and bug-prone DX. In some cases, it also results in runtime errors.
Relates to: #32251
React Version: 19.1.1
form Attributeform getter on it (similar to native form controls)form attribute to a specific <form> elementaria-invalid Attributearia-invalid attribute to trueExample Reproduction: https://stackblitz.com/edit/react-custom-elements-global-attrs?file=src%2FApp.tsx,index.html&terminal=dev
form AttributeAn error is thrown at runtime, because React tries to set a getter instead of altering the form attribute (which is what happens for native form controls).
aria-invalid AttributeThe attribute is set to an empty string ("") as if it were a literal boolean attribute.
form AttributeAn error should not be thrown, and React should not attempt to set a JS Property. Instead, React should treat the attribute the same way it does for native form controls, setting the attribute only.
aria-invalid AttributeThe attribute should be treated the same way as it is for other native elements: aria-invalid={true} should become aria-invalid="true" and aria-invalid={false} should become aria-invalid="false".
The overall expectation beyond these 2 things is that for any attribute in the set of "common/nati
Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!