-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Skeleton provides error in <p> tags #19210
Comments
@ximex What do you think of this diff? diff --git a/packages/material-ui-lab/src/Skeleton/Skeleton.js b/packages/material-ui-lab/src/Skeleton/Skeleton.js
index c4696edc7..56b0ecf51 100644
--- a/packages/material-ui-lab/src/Skeleton/Skeleton.js
+++ b/packages/material-ui-lab/src/Skeleton/Skeleton.js
@@ -74,7 +74,7 @@ const Skeleton = React.forwardRef(function Skeleton(props, ref) {
animation = 'pulse',
classes,
className,
- component: Component = 'div',
+ component: Component = 'span',
height,
variant = 'text',
width, Using a span seems to be a frequent approach: Do you want to submit a pull request? :) |
Note, the issue resonates with this comment: #7223 (comment) (button > div issue, CircularProgress). We could even address it at the same time. |
or this way? diff --git a/packages/material-ui-lab/src/Skeleton/Skeleton.js b/packages/material-ui-lab/src/Skeleton/Skeleton.js
index c4696edc7..56b0ecf51 100644
--- a/packages/material-ui-lab/src/Skeleton/Skeleton.js
+++ b/packages/material-ui-lab/src/Skeleton/Skeleton.js
@@ -74,7 +74,7 @@ const Skeleton = React.forwardRef(function Skeleton(props, ref) {
animation = 'pulse',
classes,
className,
- component: Component = 'div',
+ component: Component = props.variant === 'text' ? 'span' : 'div',
height,
variant = 'text',
width, a div makes sense for |
I'm wondering. Would being consistent be better? We render it as a display block no matter the element. |
yes the rendering is display: block. but the semantic of the html would be more correct if we use a div for block things and span for text |
OK, fair point. @ximex feel free to go ahead. |
Current Behavior 😯
Got an error in the logs
Expected Behavior 🤔
No error logs
Steps to Reproduce 🕹
Put a Skeleton in a ListItemText secondary prop. Than i got error logs in develop mode.
It's because a
<div>
in a<p>
(Secondary Typography) is invalidYour Environment 🌎
Solution
I think a skeletion variant=text should be
<span>
instead of a<div>
.The text was updated successfully, but these errors were encountered: