Open Viktor19931 opened 8 months ago
@janson @mojodna @mudge @farcaller
Please check it out Not sure how to fix this one
Thank you
I confirm this behavior.
The W3C Nu Validator failed with errors when validating assets on my Gatsby blog.
I investigated them and found them coming from the <StaticImage />
component available through the gatsby-plugin-image
, regardless of what combination of properties I passed to the component.
Error: An img element which has an alt attribute whose value is the empty string must not have a role attribute.
<img alt="" role="presentation" aria-hidden="true" src="data:image/svg+xml;charset=utf-8,%3Csvg%20he…#x27;%20version='1.1'%3E%3C/svg%3E" style="max-width:100%;display:block;position:static"/>
Element source is missing required attribute srcset.
<source type="image/webp" data-srcset="/blog/static/4a9773549091c227cd2eb82ccd9c5e3a/e789a/gatsby-ic…a9773549091c227cd2eb82ccd9c5e3a/6766a/gatsby-icon.webp 128w" sizes="(min-width: 64px) 64px, 100vw"/>
The sizes attribute must only be specified if the srcset attribute is also specified.
<source type="image/webp" data-srcset="/blog/static/4a9773549091c227cd2eb82ccd9c5e3a/e789a/gatsby-ic…a9773549091c227cd2eb82ccd9c5e3a/6766a/gatsby-icon.webp 128w" sizes="(min-width: 64px) 64px, 100vw"/>
Element img is missing required attribute src.
img data-gatsby-image-ssr="" data-main-image="" style="opacity:0" sizes="(min-width: 64px) 64px, 10…ng 64w,/blog/static/4a9773549091c227cd2eb82ccd9c5e3a/bf8e1/gatsby-icon.png 128w" alt="Gatsby icon"/>
The sizes attribute must only be specified if the srcset attribute is also specified.
<img data-gatsby-image-ssr="" data-main-image="" style="opacity:0" sizes="(min-width: 64px) 64px, 10…ng 64w,/blog/static/4a9773549091c227cd2eb82ccd9c5e3a/bf8e1/gatsby-icon.png 128w" alt="Gatsby icon"/>
Use this link to validate a sample page.
Alternatively, just visit the page and validate it from there.
I noticed the same problem with both static and dynamic images. The problem exists in the build and development environment.
System:
OS: macOS 12.7.5
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
Yarn: 1.22.18 - /usr/local/bin/yarn
npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm
Browsers:
Chrome: 126.0.6478.127
Safari: 17.5
npmPackages:
gatsby: ^5.13.5 => 5.13.6
gatsby-plugin-feed: ^5.13.1 => 5.13.1
gatsby-plugin-image: ^3.13.1 => 3.13.1
gatsby-plugin-manifest: ^5.13.1 => 5.13.1
gatsby-plugin-purgecss: ^6.2.1 => 6.2.1
gatsby-plugin-sharp: ^5.13.1 => 5.13.1
gatsby-plugin-sitemap: ^6.13.1 => 6.13.1
gatsby-remark-autolink-headers: ^6.13.1 => 6.13.1
gatsby-remark-images: ^7.13.1 => 7.13.1
gatsby-remark-prismjs: ^7.13.1 => 7.13.1
gatsby-remark-responsive-iframe: ^6.13.1 => 6.13.1
gatsby-source-filesystem: ^5.13.1 => 5.13.1
gatsby-transformer-remark: ^6.13.1 => 6.13.1
gatsby-transformer-sharp: ^5.13.1 => 5.13.1
npmGlobalPackages:
gatsby-cli: 5.13.3
None
I am willing to step in and look at the plugin myself if some kind soul points me in the correct direction and suggests ways to set-up a good debugging environment, because I have never debugged core features of a framework in JavaScript.
Please reach out to me directly, and I hope I can be of service here. Thank you.
Preliminary Checks
Description
https://validator.w3.org/ give me bunch of errors relative to gatsby-image-plugin
I think its a bug but if I am wrong please let me know. Thank you
Reproduction Link
https://codesandbox.io/p/devbox/goofy-bell-2gx8cm?file=%2Fsrc%2Fpages%2Findex.js%3A32%2C4
Steps to Reproduce
I use dynamic images in my project
Expected Result
I should pass html validation https://validator.w3.org/nu/?doc=https%3A%2F%2Famanitamuscariastore.online%2F
Actual Result
got plenty of errors with images
Environment
Config Flags
DEV_SSR: false