GoogleChrome / lighthouse

Automated auditing, performance metrics, and best practices for the web.
https://developer.chrome.com/docs/lighthouse/overview/
Apache License 2.0
28.39k stars 9.38k forks source link

Feature Req.: Accessibility: check for correct markup of language #15791

Open saschaleib opened 9 months ago

saschaleib commented 9 months ago

Feature request summary Check that the language of page parts is correctly marked up.

What is the motivation or use case for changing this? WCAG 2.1 SC 3.1.2 requires that: "The human language of each passage or phrase in the content can be programmatically determined except for proper names, technical terms, words of indeterminate language, and words or phrases that have become part of the vernacular of the immediately surrounding text."

The rationale of this requirement is that e.g. screen readers (and probably also other assistive tools) choose voice or dictionary dependent on the language of the text in order to read it properly.

There is, however, currently no check in Lighthouse to see if the language is correctly marked up.

At the same time, experience shows that this is often ignored and foreign-language texts are simply copied into a page without proper markup. This is also often related to only partially translated pages, which in turn are a more general issue for SC 3.1.

There are APIs (e.g. via Google Cloud and others) to automatically detect the language of any text. It should be possible to find incorrectly marked up language parts via these and list them as Accessibility issues in the report.

To avoid false reports, e.g if it encounters words/spellings that exist in multiple languages, foreign names, etc. there should be a minimum size of these sections that can be checked (maybe ca. 5-6 words).

How is this beneficial to Lighthouse?

Implementing this would further improve the already excellent Accessibility checking of Lighthouse and (partially) cover an area that is often neglected by other tools.

In the long term, it could also be further developed to highlight partially translated pages (example: https://commission.europa.eu/highlighted-news_fi) which may be considered to at least violate "best practices" (though it also has Accessibility implications).

adamraine commented 9 months ago

We get our accessibility advice from axe-core. Do you want to forward this feature request there as well?