fix(a11y): add lang attribute to language selector for better SR accessibility#8689
fix(a11y): add lang attribute to language selector for better SR accessibility#8689ShubhamOulkar wants to merge 2 commits intonodejs:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
👋 Codeowner Review RequestThe following codeowners have been identified for the changed files: Team reviewers: @nodejs/nodejs-website Please review the changes when you have a chance. Thank you! 🙏 |
|
Hi @avivkeller, why preview failed? |
|
Hi everyone 👋, during accessibility testing of the language selector, I observed inconsistent support for Chrome + Narrator correctly switches pronunciation based on This seems to be an AT/browser interoperability limitation. I am investigating alternative patterns (e.g. exposing English labels alongside native names) to improve robustness. Note Testing on macOS Safari with VoiceOver would be helpful to further validate behavior. |
Description
This PR fixes an accessibility issue where screen readers (like Windows Narrator, android Talk back) were unable to correctly announce language names in the language selector.
Changes:
hrefLangto theSimpleLocaleConfigtype.langattribute onDropdownMenu.Itemusing thehrefLangproperty.Manual Testing Recordings:
Important
I have used the
hrefLangproperty for thelangattribute instead of the internalcodeproperty.In this project,
codeis often used for internal routing and directory structures (e.g. zh-cn), whereashrefLangcontains best current practice language tags (e.g. zh-Hans). Using hrefLang ensures that screen readers receive the most accurate language hint for pronunciation.closes #8668
Note
Additional Testing Welcome
These changes have not been tested on macOS (VoiceOver). If any maintainer or contributor has access to a Mac, verification on VoiceOver would be very helpful to ensure consistent multilingual accessibility across all platforms.
Check List
pnpm formatto ensure the code follows the style guide.pnpm testto check if all tests are passing.pnpm buildto check if the website builds without errors.