Improve screen reader support
See original GitHub issueThe Lighthouse report often shows the following warning:
<html>
element does not have a[lang]
attribute.
If an Ember app only has a single language then we can set that language in the index.html
, but when supporting multiple languages it gets a little more tricky. I would like to propose doing something like this:
setLocale(locale) {
// ...
document.documentElement.lang = locale;
}
This should result in something like <html lang="de">
and will hopefully improve the Lighthouse score and screen reader support.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:15 (5 by maintainers)
Top Results From Across the Web
How to Design Your Website for Screen Reader Accessibility
Learn what screen readers are, how they help users navigate your website, and how to design your website to accommodate for those who...
Read more >Tips to Improve Website Content for Screen Readers
A technique that improves readability for your audience also works well for screen readers: Use shorter sentences and bullet points. Ann Smarty ...
Read more >Seven Screen Reader Usability Tips - SitePoint
The seven easy tips below will drastically improve a site's usability for screen reader users, as well as all other visitors.
Read more >Make Your Webpages Accessible - Amherst College
Reduce clutter. Busy pages can be cumbersome to navigate via keyboard. Avoid repetition and unnecessarily long text. Screen-Reader Accessibility.
Read more >30 Web Accessibility Tips | AccessComputing
Do not skip heading levels. They help non-visual users (including search engines) to understand how the page is organized, and make it easy...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Most of the time I favor doing anything with DOM in components, even if that means an addon needs to tell people to put a singleton component in their templates. Trying to manipulate DOM from a service or route tends to make things fragile, especially in tests.
This particular case is simple enough that if you do it carefully it’s probably ok.
Bigger picture, there’s not really a strong reason we couldn’t make the
<html>
and<body>
tags be inside an app’s templates, instead of being special outside them. The obvious way to implement this feature is to give people a helper and let them say<html lang={{locale-name}}>
this seems to work quite well, but it has the disadvantage of needing a component 🤔