-
Notifications
You must be signed in to change notification settings - Fork 47.7k
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
Bug: Prop with name "is" breaks the className prop on tag #17944
Comments
If you set an Because of this, props like The documentation mentions this briefly https://reactjs.org/docs/web-components.html
I can agree that it's def a bit confusing 😅 |
@michalczaplinski is correct! The https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/is
In this case, I think React DOM is behaving reasonably (although I understand why it could be a bit surprising too) |
This issue has come up a few times in the past:
Dan's comment seems inline with ours above: There's also been some extensive discussion about the Our web component docs suggest using a I'm going to close this issue since I think it's all been discussed before 😄 |
Maybe would be good to have a section on docs saying about this. What do you think? It's hard to search because of the word "is", so, if we add a FAQ explaining, it will avoid that kind of issues being opened. I just opened because I didn't find anything on docs or github issues, searching for keywords like "prop html tag is className attribute". :) |
Sure, if you have ideas for how to improve the docs page send them our way. This page: Is here: |
If you add a prop named "is" together with a "className" prop, on a html tag component
(e.g.
<div is="p" className="text-red">
) it "breaks" the markup and render an attribute "classname" instead of "class".React & React DOM version: 16.12.0
Steps To Reproduce
Link to code example: https://codesandbox.io/s/quiet-sun-535rg
Example:
<div is="p" className="text-red">I'm not red</div>
The current behavior
Injecting the props as html attrs.
Markup:
<div is="p" classname="text-red">I'm not red</div>
The expected behavior
Markup:
<div is="p" class="red">I'm red</div>
The text was updated successfully, but these errors were encountered: