Skip to content
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

Populate lang attribute on root html element when translator is present. #261

Closed
ktsimpso opened this issue Feb 26, 2023 · 2 comments
Closed
Labels
C-enhancement Category: enhancement tribble-reported This issue was reported through Tribble.

Comments

@ktsimpso
Copy link

This issue is requesting an enhancement to Perseus. Details of the scope will be available in issue labels.
The user described the problem related to this request as follows:

Populate lang attribute on root html element when translator is present.

The user described the issue as follows:

Lighthouse Accessibility score recommends populating the lang attribute to help screen readers announce text correctly. See: https://dequeuniversity.com/rules/axe/4.4/html-has-lang?utm_source=lighthouse&utm_medium=devtools

Since Perseus should know the lang of the page when a translator is present, it should automatically populate this attribute.

  • The author is willing to attempt an implementation: false
Tribble internal data

dHJpYmJsZS1yZXBvcnRlZCxDLWVuaGFuY2VtZW50

@github-actions github-actions bot added C-enhancement Category: enhancement tribble-reported This issue was reported through Tribble. labels Feb 26, 2023
@arctic-hen7
Copy link
Member

This should be fairly trivial, since, according to MDN, the lang attribute accepts the same BCP-47 language tags, which means we can just use the locale strings Perseus already works with internally. Beta 20 is being released as I write this with a deployment fix, but this will go in beta 21, since there's no reason to delay this (the website will be used as a production validation that this appeases Lighthouse, since it uses i18n).

@ktsimpso
Copy link
Author

Awesome, thanks! Will try this out when beta 21 releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: enhancement tribble-reported This issue was reported through Tribble.
Projects
None yet
Development

No branches or pull requests

2 participants