question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Skeleton provides error in <p> tags

See original GitHub issue
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

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 invalid

Your Environment 🌎

Tech Version
Material-UI v4.8.3
React v16.11.0
Material-UI/lab 4.0.0-alpha.39

Solution

I think a skeletion variant=text should be <span> instead of a <div>.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ximexcommented, Jan 13, 2020

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

1reaction
ximexcommented, Jan 13, 2020

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 rect and circle

Read more comments on GitHub >

github_iconTop Results From Across the Web

Skeleton provides error in <p> tags #19210 - mui/material-ui
The issue is present in the latest release. I have searched the issues of this repository and believe that this is not a...
Read more >
Using an HTML Skeleton - W3Schools
The HTML page is missing head tags. Head tags are not needed in HTML. In HTML, everything before the body tag is considered...
Read more >
What is HTML skeleton? | Sololearn: Learn to code for FREE!
The basic HTML skeleton is the set of tags required of every HTML web page you build. The tags that make up the...
Read more >
What is skeleton in HTML?
The basic HTML skeleton is the set of tags required of every HTML web page you build. The tags that make up the...
Read more >
How to expand error messages truncated by Skeleton (<< >>)
An answer to the original question of how to show the full message abbreviated by the skeletons can be found in an old...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found