Lectora generating illegal HTML
April 17, 2013 12:00 AM
All,
I am happy to be corrected if I am wrong, but in my attempts to evaluate WCAG 2.0 accessibility compliance I have discovered a concerning aspect of Lectora's html generation, ie it appears to be generating illegal code.
Accessibility guidelines recommend using header tags (H1 & H2 etc) to facilitate screen readers. Lectora allows this but it embeds a paragraph tag (to apply formatting) within the H1 tags. According to what I have read on the W3C site this is not permitted (ie its illegal code), and it is coming up as an error in the validator, which seems to support that view. This is also a failure (non-compliance) under WCAG 2.0 Section 4.1.1 at Level A and will result in us doing significant post-packaging fixes (at least one on every screen) if we can't stop it from happening.
Does anyone know if this is something that I am inadvertently causing and if there is some way I can stop Lectora from doing this?
Does anyone know of any addendum to W3C HTML reference that allow this embedding (P inside H1) to occur legally?
Discussion (7)
The ability to include an H1 is specifically for the screen readers, such as JAWS. I believe JAWS is able to read these H1 and H2 text blocks is it not?
If so, it seems like it is accomplishing its mission of having accessible header labeled text blocks, even if a WCAG validator doesn't like the code.
Unfortunately not.
The Australian Government has passed legislation that all government websites, external and internal, must adhere completely with WCAG 2.0 Level A from December 2012. Non-conforming websites must be taken down - there may be fines. We shift to Level AA as of December 2014.
WCAG 2.0 Section 4.1.1 (Level A) clearly states that "elements are nested according to their specifications,". Nesting P tags in H1 tags is not allowed in HTML. Major problem for me, and anyone, developing for any government agency, at any level, in Australia.
The other issue is that we have 50 Lectora licences that are about to be upgraded to v11. If I can't solve this, and other compliance issues, before we have to commit to the upgrade I don't see how I can let it go ahead. We simply won't be able to use any version of Lectora without major post packaging work. It will be very disappointing to leave Lectora behind given the skills and knowledge we have developed in it over the past few years but we really will not have much choice.
We need a solution, any solution, that is WCAG 2.0 Level AA compliant out of the box. Lectora is not doing that at the moment. It really is almost there, but failing to nest tags properly, and using deprecated attributes, could mean that it is no longer fit for purpose.
I think I have a solution, though not exactly elegant.
If I place an external HTML/extend HTML item in the page and set the content to be
My title
I can get the header in without the issues of theinside
. In addition I can set the styling for the H1 in CSS and be assured that all my titles are consistently styled.
I won't be able to see the title in the development environment - which is a pain - but it will produce legal code with me having to do manual manipulation of a post package file.
On to the next accessibility issue...
Ssneg,
Thanks for the reply.
My solution didn't work because the
tag was being placed inside an anchor tag - something that isn't permitted either.
I really hope that someone at Lectora is looking at how to achieve properly formed "legal" html. I am spending a great deal of time finding solutions to deficiencies in their html creation process. I realise that this never used to matter, so long as it worked. Unfortunately that not good enough any more, not for my clients anyway.
Are there any issues with using Jquery that I should be aware of? I haven't used it before.
You can add one line of JQuery to unwrap P tags into the H1 tag, like this: http://stackoverflow.com/questions/9309135/how-to-remove-p-tags-within-a-div
You just have to make sure that JQuery manipulates DOM before your screen reader gets to it.
Ssneg,
Thank you again, that worked extremely well.
I was even able to remove the class tag from the span so that styling of headers can be controlled via CSS. Now if I want to change the header style of every page I just change one CSS reference ;)
Discussions have been disabled for this post