-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty <html> lang attributes report as fail of html-has-lang, pass for html-lang-valid #3624
Comments
We try to avoid having axe-core report the same problem more than once. There's not much more to it than that. It's important to know that even if a rule passes, it's always possible for there to be some other issue. We could update the rule selector of |
Hi @WilcoFiers, thank you for looking into this! Researching this further, I learned that the HTML page has lang attribute ACT rule specifically expects a failure for
… so your suggestion to have the rule marked as inapplicable in this case seems spot on. Unfortunately although this scenario is documented in the ACT rule description, there isn’t a test case for it there, so implementations seem to differ (Axe passes, Alfa seems to report as inapplicable). |
@thibaudcolas ACT implementations are not required to consistently report on passed / inapplicable. Those two outcomes are effectively interchangeable as far as ACT is concerned. There are multiple reasons for that. Many tools don't even report inapplicable, for example. Those should still be able to implement ACT rules. It also comes from that WCAG doesn't have the concept of inapplicable. A success criterion is either satisfied, or it isn't. What ultimately matters is that tools/testers only fail things that should fail. I'll leave this ticket open for us to update this selector. It should be a fairly straightforward tweak to the rules elector. |
Cool!
Would this be something along the lines of |
@thibaudcolas Pretty much, yes. We'll need some integration tests to go with it in |
I gave this a go at #3663 but unfortunately got stuck with an issue with the CSS selector processing. |
Product
axe-core
Product Version
4.4.2
Latest Version
Issue Description
For
<html lang="">
,html-has-lang
fails, andhtml-lang-valid
passes. This is a similar issue to #3623, where I would expect the rules to be consistent with one-another.Expectation
Both rules should be consistent. If
lang=""
is indeed a valid lang attribute value, thenhtml-has-lang
should pass (both rules should pass). If it’s not a valid value, then either both rules should fail, or onlyhtml-lang-valid
should fail.Actual
Currently,
<html lang="">
passeshtml-lang-valid
.How to Reproduce
Here are two sites where this happens, and Axe CLI commands:
In each case, see the
html-has-lang
violation whilehtml-lang-valid
is marked as a "pass".Additional context
Similarly to #3623, I was also tempted to report this to Lighthouse instead / in addition to Axe, as its overly simplified audit messages make this even more confusing. It would report:
<html> element does not have a [lang] attribute
"<html> element has a valid value for its [lang] attribute
"The text was updated successfully, but these errors were encountered: