Comments (6)
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.
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.
<a> Hello </a>
The audit fails for me here as well. Not noticing any difference between images/text.
from lighthouse.
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.
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.
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)
- Lighthouse fails to produce accessibility score altogether for incomplete axe-core result HOT 4
- People detect Lighthouse to cheat its performance score HOT 4
- Isolate lantern in preparation for moving to trace engine
- Gathering trace data from iframe targets HOT 5
- Protocol error (Storage.getUsageAndQuota): Quota information is not available HOT 1
- Invalid_url when trying to run in Incognito HOT 2
- Page is hidden at first causing a `visibilitychange` event during testing HOT 11
- INP report in Detail HOT 2
- RootCauses Artifact is slow if there are lots of "SVG changed" invalidations HOT 3
- TraceElements: `impactedNodes` is not iterable HOT 3
- Allow clicking on timeline images to open the full-size image HOT 1
- Lighthouse SEO section shows "unable to download a robots.txt file" for every site HOT 5
- layout-shifts `details.headings[n].subHeadings` is missing `valueType: 'node'` HOT 1
- zstd not recognized as compression (new in M123)
- Mobile test should also emulate having a `coarse` pointer device. HOT 6
- How to configure triggered of the end of a navigation?
- Utilize localized failure messages from axe HOT 1
- Excessive style recalcs caused by CSS usage tracking HOT 4
- Improve documentation on standalone mode runners HOT 5
- Page crashes when running test from large DOM.getDocument response HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lighthouse.