Closed JoshTumath closed 1 year ago
This is related to ORBIT elements, so relevant for all pages, not only Children's pages.
Josh shared https://www.w3.org/WAI/tutorials/page-structure/headings/#main-heading-after-navigation, which is a good example of the situation we have.
It should be straight forward enough to remove the scenario at line 142 of https://github.com/bbc/bbc-a11y/blob/master/features/standards/mag/structure/02_headings.feature, and related tests.
However, I think it might be wise to include a check for h1 being the first heading within the main container. We do have checks that the page has one main container, so it would be reasonable to have a warning on that, so that h1 not being first is not abused.
<body>
<nav>
<h2>Foo</h2>
<!-- navigation elements -->
<nav>
<main>
<h1>This will pass</h1>
<h2>Foo</h2>
<!-- content elements -->
<main>
</body>
<body>
<nav>
<h2>Foo</h2>
<!-- navigation elements -->
<nav>
<main>
<h2>Bar</h2>
<!-- some elements -->
<h1>This will send a warning</h1>
<h2>Foo</h2>
<!-- content elements -->
<main>
</body>
Actually, thinking about this further, there may be many cases where you don't want the main heading (h1
) to be in the main
content. For example, on a homepage where there is no particular content, you may wish to put this in the header of the page.
I think this is falling into the remit of what meets guidelines and what could be considered good practice.
Here are the guidelines we look to:
What we would expect:
If the page has a main element (expected by the HTML guide) then the h1 should probably be the first heading within that main element, which should contain all the main content of the page that the h1 would be considered a label for. For BBC homepage or any index page the main content is usually the page banner with the h1 and the promos linking to other content.
If there are headings before the h1, they may be ignored when determining if headings after the h1 are "sequential". I would not want to encourage headings before the h1, but neither would I want to dictate what level of heading is or isn't OK before the h1.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.
Summary
Pages that contain headings before the
h1
element fail the test named 'Structure: Headings: Headings must be in ascending order', even though this is not forbidden by BBC accessibility guidelines or the HTML specification.Expected Behaviour
No warnings.
Current Behaviour
When running the tool on a page that contains a
h2
element before theh1
, a warning like this is displayed:Possible Solution
The rule 'Structure: Headings: Headings must be in ascending order' could be either:
h1
elementSteps to Reproduce
For example, in the following HTML snippet, the first
h2
would cause a warning.Context & Motivation
On the BBC Children's websites, a cookie banner appears with a
h2
heading. It appears before the article'sh1
heading, causing the rule to fail.Your Environment