WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Screen reader testing on language switching components.

for

From: Mark Magennis
Date: Apr 28, 2025 10:25AM


Hi Brian,

The last time I looked at language switchers (maybe three years ago) it was difficult to code a language menu that worked well with all screen readers and worked equally well when you changed the screen reader’s language. This was due to variable support for the lang attribute, particularly within an ARIA menuitem. It turned out to be less problematic to avoid using an ARIA menu. But if using a menu, I found after a lot of experimentation that the best pattern was to:

1. Display language options using the character set and spelling of their language.
2. Add the lang attribute to each menuitem, set to the appropriate value for the language (except for the currently selected language where it is best to leave out the lang attribute).
3. Add an aria-label to each menuitem, containing the language name as it is spelled in the current UI language.
4. Add the suffix “, current language” to the aria-label of the option that was shown as selected (had a tick mark).

This resulted in options being repeated twice by some screen readers and in some slightly unclear choices like “Castilian Spanish Mexican Spanish” but it seemed to offer the best overall results where at least every option was read and in a language that is understandable to the user. But best to avoid using an ARIA menu like I said.

Mark

Mark Magennis
Principal Product Manager, Accessibility

[Skillsoft]<http://www.skillsoft.com/>;