Giter VIP home page Giter VIP logo

Comments (6)

connorjclark avatar connorjclark commented on May 22, 2024 2

relevant spec

If the a element has an href attribute, then it represents a hyperlink (a hypertext anchor) labeled by its contents.

If the a element has no href attribute, then the element represents a placeholder for where a link might otherwise have been placed, if it had been relevant, consisting of just the element's contents.

The target, download, ping, rel, hreflang, type, and referrerpolicy attributes must be omitted if the href attribute is not present.

If the itemprop attribute is specified on an a element, then the href attribute must also be specified.

Agreed we should not flag <a> as an uncrawlable link based on the spec.

We should still call it out if it has any of these must-not-be-present attributes when href is missing.

Thanks for bringing this to us!

from lighthouse.

adamraine avatar adamraine commented on May 22, 2024 1

I expect Lighthouse to embrace the relevant specifications and to not give any warnings here.

Yeah I think we can discuss changing this. Although the link is not crawlable this doesn't appear to be a bad practice that search documentation warns against.

I also expect Lighthouse to have consistent behavior between anchor tags without href when they contain text vs. when they contain images.

Not sure what you are referring to here, what differences did you noticed between anchor tags containing images vs text?

from lighthouse.

adamraine avatar adamraine commented on May 22, 2024 1
<a>
	Hello
</a>

The audit fails for me here as well. Not noticing any difference between images/text.

from lighthouse.

romainmenke avatar romainmenke commented on May 22, 2024 1

You are right!

I was testing with an anchor element that also had an id attribute.
My assumption that it had to do with image/text content was incorrect.

from lighthouse.

romainmenke avatar romainmenke commented on May 22, 2024

I also expect Lighthouse to have consistent behavior between anchor tags without href when they contain text vs. when they contain images.

Not sure what you are referring to here, what differences did you noticed between anchor tags containing images vs text?

This triggers a warning:

<a>
	<img src="https://picsum.photos/200/300" alt="" width="200" height="300" loading="lazy">
</a>

This does not:

<a>
	Hello
</a>

from lighthouse.

romainmenke avatar romainmenke commented on May 22, 2024

Thank you for updating the title.
I've also crossed out the incorrect statement in the initial report and updated the html content of the example page

This better reflects the issue.

from lighthouse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.