JueK3y
JueK3y

Reputation: 317

Lighthouse false flag

I put my website through the Lighthouse test via web.dev and there I am shown 2 "errors" that I can not quite comprehend.

1st point: "Form elements do not have associated labels".
Lighthouse thinks that I do not use a label for a form. However, I have the following in my code:

<input id="burger" type="checkbox" />
<label for="burger">

This is the only time I use input at all.
So why does this message come up then?

2nd point: "robots.txt is not valid".
I use the following content for my robots.txt file:

User-agent: *
Disallow: /testlab/
Disallow: /en/page-not-found.htm
Disallow: /en/page-not-found.htm

User-agent: WebReaper
User-agent: WebCopier
User-agent: Offline Explorer
User-agent: HTTrack
User-agent: Microsoft.URL.Control
User-agent: EmailCollector
User-agent: penthesilea
Disallow: /

sitemap: https://link-to-sitemap.com

As far as I know, the content should be recognized by different crawlers.
So why do I see this as an error in the Lighthouse test?

Here is the link to the website, if you want to run the test on your own: https://type-error.netlify.app

A small note: I have set redirects and headers via a netlify.toml file, maybe this will help.

Edit: When running the Lighthouse Test with the Chrome Dev Tool, more information to the robots.txt show up: "Lighthouse was unable to download a robots.txt file".

Upvotes: 1

Views: 627

Answers (1)

Omnichief
Omnichief

Reputation: 66

1. Form elements do not have associated labels

You have an opening label element without any closing element or name.

<input id="burger" type="checkbox" />
<label for="burger">

You should have a closing tag and a proper label name.

<input id="burger" type="checkbox" />
<label for="burger">burger</label>

2. robots.txt is not valid

The "robots.txt is not valid" is indeed a false flag. See - https://github.com/GoogleChrome/lighthouse/issues/12936

I have run into the same issue on my own sites. However, when using the lighthouse for chrome extension it passes. There seems to be an issue with the dev tools version.

lighthouse for chrome SEO audit

Upvotes: 1

Related Questions