WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Use of 'lang' attribute?

for

From: Steve Faulkner
Date: Nov 2, 2015 12:35PM


Hi Joseph,

It is a non conforming use of the lang attribute.

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. Its value must be a valid BCP 47 language tag, or the empty string.
> Setting the attribute to the empty string indicates that the primary
> language is unknown.


Whether it will cause issues with AT or not is unknown. But there is no
need to use the attribute as it is being used in the example code. If the
developer wants to use an attribute with an abitrary set of values they can
use the data-* attribute
<http://www.w3.org/TR/html5/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes>

for example:

<th data-lang="isSelected" rowspan="1" colspan="undefined">


--

Regards

SteveF
Current Standards Work @W3C
<http://www.paciellogroup.com/blog/2015/03/current-standards-work-at-w3c/>;

On 2 November 2015 at 18:50, Joseph Sherman < <EMAIL REMOVED> > wrote:

> Is there any other use of the 'lang' attribute besides specifying language?
> I am looking at a web application that uses the 'lang' attribute all over
> the place. Most all elements have 'lang', for example, here's a row of
> table headers:
>
> <tr><th lang="isSelected" rowspan="1" colspan="undefined"><span
> class="headerText">Selected</span></th><th class="alt sortable"
> lang="employee" rowspan="1" colspan="undefined"><span
> class="headerText">Last / First</span></th><th class=" sortable"
> lang="payroll" rowspan="1" colspan="undefined"><span
> class="headerText">EMPL ID</span></th><th class="alt sortable"
> lang="totalHoursWorked" rowspan="1" colspan="undefined"><span
> class="headerText">Total Worked Hours</span></th><th class=" sortable"
> lang="totalPaidAbsences" rowspan="1" colspan="undefined"><span
> class="headerText">Total Paid Absences</span></th>
>
> Even the login form password field has it: <td class="localize"
> lang="password">Password</td>
>
> Is there any reason for this? Can it confuse a screen reader or is it
> harmless?
>
> Joseph
>
> > > > >