WebAIM - Web Accessibility In Mind

E-mail List Archives

Thread: Use of 'lang' attribute?

for

Number of posts in this thread: 4 (In chronological order)

From: Joseph Sherman
Date: Mon, Nov 02 2015 11:50AM
Subject: Use of 'lang' attribute?
No previous message | Next message →

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

From: Graham Armfield
Date: Mon, Nov 02 2015 12:31PM
Subject: Re: Use of 'lang' attribute?
← Previous message | Next message →

Looks to me as though the developer has been stuffing useful auxiliary
information into the attribute without appreciating what the attribute is
really for.

With HTML5 doctype, this sort of information could be in data- attributes,
but perhaps this dates from HTML4 doctype days when data- attributes would
trigger validation errors.

Regards
Graham Armfield
On 2 Nov 2015 18:50, "Joseph Sherman" < = EMAIL ADDRESS 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
>
> > > > >

From: Steve Faulkner
Date: Mon, Nov 02 2015 12:35PM
Subject: Re: Use of 'lang' attribute?
← Previous message | Next message →

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 ADDRESS 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
>
> > > > >

From: Kevin Prince
Date: Fri, Nov 06 2015 12:08AM
Subject: Re: Use of 'lang' attribute?
← Previous message | No next message

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 ADDRESS 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 ADDRESS 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
>>
>> >> >> >> >>
> > > >