Showing results for 
Search instead for 
Did you mean: 

Ability to set the lang attribute of elements with text

Currently the HTML lang attribute is set by the user's browser. In a multilingual app where the user can change their language, there's no way to change this lang attribute value without a custom code component, and even then, it only affects the iframe DOM, and not the parent DOM.


For screen reader users, this creates an accessibility problem since the text is read according to the lang attribute. This also causes a failure of WCAG 2.1, 3.1.2: Language of Parts.

 A simple test to show the problem is:

  1. Create a canvas app with French text in a text input.
  2. Set your browser language to English (US).
  3. Using JAWS or NVDA screen readers, visit the app.  The French is misinterpreted as English by the screen reader and chaos ensues.

Ideally, it should be possible to update the <html lang> attribute as needed.  It would also be helpful to be able to set an element's lang attribute since pages with multilingual content need to be able to differentiate the language of different elements.

Status: New