lang and aria attributes (Re: Hawaiian Diacritics)

Hi,

According to the HTML5 spec,

"The lang attribute (in no namespace) specifies the primary language for the element's contents and for any of the element's attributes that contain text."
(Source: https://html.spec.whatwg.org/multipage/dom.html#the-lang-and-xml:lang-attributes )

The lang attribute worked the same way in HTML 4.01:

"This attribute specifies the base language of an element's attribute values and text content."
(Source: https://www.w3.org/TR/html401/struct/dirlang.html#adef-lang )

By my reading, if a screen reader speaks the values of aria-* attributes in a different language than that defined in the lang attribute, this should be considered a bug. (If the element has no lang attribute, you obviously need to look for an ancestor with a lang attribute.)

Validators reject a few ISO 639-3 tags for languages that have no ISO 639-1 tag, but "haw" seems to work fine. I have a test page with over 500 language tags at https://cstrobbe.gitlab.io/languagelearning/misc/languagetags.html (warning: 313.5 KiB and content in many different scripts).

Best regards,

Christophe Strobbe


> On 07 May 2022 at 02:13 "Patrick H. Lauke" <redux@splintered.co.uk> wrote:
> 
> 
> On 06/05/2022 21:32, David Woolley wrote:
> 
> > In the example, your tool output is missing a lang attribute.  I think:
> > 
> > <span aria-label=”Hawaii”>Hawaiʻi</span>
> 
> Worth noting that the aria-label theoretically overrides anything inside 
> the span, so the lang attribute would be pointless. Also worth noting 
> that an aria-label on a generic span is generally (depending on 
> browser/AT combination) not supported, as a generic span is not a an 
> element that has a label/name. 
> https://developer.paciellogroup.com/blog/2017/07/short-note-on-aria-label-aria-labelledby-and-aria-describedby/
> 
> P--
> Patrick H. Lauke
> 
> https://www.splintered.co.uk/ | https://github.com/patrickhlauke
> https://flickr.com/photos/redux/ | https://www.deviantart.com/redux
> twitter: @patrick_h_lauke | skype: patrick_h_lauke
>

Received on Monday, 9 May 2022 11:48:33 UTC