WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: heading as child of another heading - valid?


From: Steve Faulkner
Date: Mar 30, 2018 1:00PM

It is a conformance error as per the HTML spec, headings cannot be nested.
If you test a simple case the error is shown. In the case of your example
code there is an error in the patent elements that suppresses validation of
child elements, which is probably why it does not get flagged.

On Friday, 30 March 2018, Tomlins Diane < <EMAIL REMOVED> >

> I ran into this bit of code the other day on one of our sites (for an
> accordion, which is bad enough in and of itself):
> <h4 class="panel-title">
> <a data-toggle="collapse" data-parent="#accordion"
> href="#collapseImage1" aria-expanded="true" aria-controls="collapseImage1"
> >
> <img class="centered" alt="" src="/util/images/campaigns/
> virtual-care/header.png">
> <h2 style="text-align: center;">Healthcare excellence at your
> fingertips. <i aria-hidden="true" class="icon-plus-sign-2"></i></h2>
> </a>
> </h4>
> An H2 nested INSIDE an H4. When I ran it through the Nu validator, it
> didn't flag this nesting as an error, not even a warning. Why is this not
> flagged??
> I found some old references on the web where the older validator DID flag
> it with " Heading cannot be a child of another heading", so is it somehow
> not an issue any longer? I've been writing HTML for a very long time, and
> I would flag this as invalid.
> Does this cause any issues for AT? I only have NVDA as my frame of
> reference.
> Thanks!
> Diane R Tomlins
> HCA IT&S | Digital Media
> Accessibility SME
> > > > >



Current Standards Work @W3C