I have a page that onload runs some JavaScript that sets a value for
lang on the html element.
What concerns me is that if this is "too late" for screen readers to correctly interpret the page's language. That is, does the appropriate
lang attribute need to be hard coded in the page for screen readers to recognise it?
Would using DOMContentLoaded be safer?
On 13/11/2018 2:50 pm, Andrew Poulos wrote:
I have a page that onload runs some JavaScript that sets a value for
lang on the html element.
What concerns me is that if this is "too late" for screen readers to
correctly interpret the page's language. That is, does the appropriate
lang attribute need to be hard coded in the page for screen readers to
recognise it?
Would using DOMContentLoaded be safer?
After some testing, using DOMContentLoaded triggers Chrome to ask if I
want the page translated so maybe it will also be picked up by screen readers.
Andrew Poulos wrote:
On 13/11/2018 2:50 pm, Andrew Poulos wrote:
I have a page that onload runs some JavaScript that sets a value for
lang on the html element.
What concerns me is that if this is "too late" for screen readers to
correctly interpret the page's language. That is, does the appropriate
lang attribute need to be hard coded in the page for screen readers to
recognise it?
Would using DOMContentLoaded be safer?
After some testing, using DOMContentLoaded triggers Chrome to ask if I
want the page translated so maybe it will also be picked up by screen
readers.
Your argument is based on the assumption that all user agents with which screen readers can be used also execute client-side scripting (in a DOM-compatible way). This assumption is false: a prominent counter-example is Lynx.
Therefore, too, always generate the initial �lang� attribute value *server-side*.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,025 |
Nodes: | 10 (0 / 10) |
Uptime: | 151:57:54 |
Calls: | 13,305 |
Calls today: | 2 |
Files: | 186,574 |
D/L today: |
4,272 files (1,054M bytes) |
Messages: | 3,350,488 |