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.

Image no explicit width/height on SVG with dimensions

See original GitHub issue

Provide the steps to reproduce

  1. Run LH on https://quiamo-client.vercel.app/

See this https://www.webpagetest.org/result/201105_DiRY_c6737940edb79c8e59f605ae6c6b577c/

What is the current behavior?

Screenshot 2020-11-05 at 17 04 52

What is the expected behavior?

It should work fine as the SVG actually has dimensions. To put this into context, the markup in question is the result of the new Next.js Image component that , as you may be aware, was developed with collaboration with your team. See the docs at https://nextjs.org/docs/basic-features/image-optimization

This is the Next.js/React markup:

                      <Image
                        src="/images/main-logo.png"
                        alt="quiamo logo"
                        className={classes.branding}
                        width="180"
                        height="60"
                        loading="eager"
                        priority
                    />

And the corresponding HTML:

Screenshot 2020-11-05 at 17 24 12

Environment Information

  • Affected Channels: webpagetest.org
  • Lighthouse version: as per webpagatest.org
  • Chrome version:
  • Node.js version:
  • Operating System:

Related issues

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:82
  • Comments:20 (8 by maintainers)

github_iconTop GitHub Comments

34reactions
spanickercommented, Dec 21, 2020

any ETA on a fix?

17reactions
paulirishcommented, Nov 9, 2020

Maybe we’ll ignore non-network images with a SVG MIME type (potential problem what if SVG doesn’t have dimensions, invalid, etc it will cause layout shift).

+1. Let’s do this and comment it out. It’s a compromise solution but works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Fix] Image Elements do not have explicit width and height ...
In this tutorial, we are going to fix Image Elements do not have explicit width and height in GeneratePress WordPress Theme.
Read more >
Image elements do not have explicit width and height
Short Answer. Add the image's native width and height in pixels as attributes on the image. This lets the browser calculate the aspect...
Read more >
Quick Tips: How to fix "Image elements do not have explicit ...
Option 1 - define the width and height of the image using the width and height attributes. ... The first option is to...
Read more >
Use explicit width and height on image elements for svg logo
Hi,. To remove this warning, you can add width and height attribute to your site logo. To do that, you can use the...
Read more >
SVG Logo file – no explicit width and Height - WordPress.org
Is there any way to exclude specific image/container from auto-exclude list if that is the case ? The page I need help with:...
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