WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Use of 'lang' attribute?

for

From: Kevin Prince
Date: Nov 6, 2015 12:08AM


It's horrible code and you should fail it if you are doing an audit but, unless he uses an attribute with a name matching a synth that is loaded, AT should ignore it.

Some of the trash that developer send out is quite frightening.

Kev
Access1in5
0212220638
039290692
Independent Accessibility and IT Consultancy.



> On 3/11/2015, at 08:35, Steve Faulkner < <EMAIL REMOVED> > wrote:
>
> 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
>>
>> >> >> >> >>
> > > >