Language element for HTML tag and set language for spans

Is it possible to set the lang attribute in the top level HTML tag? WCAG2.0 indicates that this is a necessity for Level A compliance?


Likewise is there a way to place a span around text of a foreign language word or phrase and specify the language for that word or phrase? This appears to be a requirement for WCAG level AA compliance.


I am using Lectora X.6


This is a critical issue for us as any html (including intranet based eLearning) produced for the Australian Government must (under legislation) comply with Level A (as of 2012) and Level AA (as of 2014).

Discussion (3)

@ssneg 50072 wrote:


Hope that helps.



Thank you very much, that helps a lot. I will post later after I have had a chance to test it and let you know how I go.


Its a very scary time at the moment with the WCAG issues. All its going to take is one thing - just one - that makes our eLearning non-compliant to Level A and we'll have to take it down.


Next year with mandatory Level AA is going to be even worse. I fear we'll end up having to code everything in something like Dreamweaver because our current tools just don't give us access to the level of code we need to make the adjustments necessary to meet the compliance requirements.

@Sprockets 50069 wrote:

Is it possible to set the lang attribute in the top level HTML tag?

Likewise is there a way to place a span around text of a foreign language word or phrase and specify the language for that word or phrase?



First question: yes, using JavaScript's element.setAttribute() method. Here's a tutorial: http://www.w3schools.com/jsref/met_element_setattribute.asp


Second question: yes, but not in an easy or convenient way. Lectora does not allow for HTML tags inside text boxes, but it creates SPAN elements for each type of text formatting you use. E.g. when you type in Lectora "something everything nothing", it doesn't add STRONG or B around "everything", it adds a whole SPAN attribute with a separate class. So you can target that SPAN with JavaScript and add attributes to it as before, but it is not as convenient as targeting the HTML element obviously. And, of course, this requires you to add a separate style to those words, although it's not a bad idea to put foreign words in italics anyway.


Hope that helps.

That all worked well.


Changing the html tag was actually quite easy (after I relised that the first child was a comment, and that the html tag was the second child.


I was also able to place the language tag on a section of text but as you indicated - it was quite a bit more trouble. And it is likely to break if I later manipulate the text so that the parent/child relationship changes the tree order of the targetted span tag.


Still it can be done! On to the next compliance issue.

Discussions have been disabled for this post