-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow first headings to be level 2 #285
Changes from all commits
1b35e88
94f9091
30c5e9e
db1857d
f9db4a5
523e38e
a6ce7bb
7734204
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ Feature: Display failing result | |
""" | ||
✓ http://localhost:54321/subheading_first.html | ||
⚠ Structure: Headings: Headings must be in ascending order | ||
- First heading was not a main heading: /html/body/h3 | ||
- First heading was not a level 1 or level 2 heading: /html/body/h3 | ||
|
||
For details on how to fix these errors, please see the following pages: | ||
- http://www.bbc.co.uk/guidelines/futuremedia/accessibility/mobile/structure/headings | ||
|
@@ -33,11 +33,11 @@ Feature: Display failing result | |
""" | ||
✗ http://localhost:54321/two_headings_failures_and_one_warning.html | ||
⚠ Structure: Headings: Headings must be in ascending order | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possibly change to "Headings after the h1 must be in hierarchical order' |
||
- First heading was not a main heading: /html/body/h2 | ||
- First heading was not a level 1 or level 2 heading: /html/body/h4 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See previous comments |
||
* Structure: Headings: Exactly one main heading | ||
- Found 0 h1 elements. | ||
* Structure: Headings: Content must follow headings | ||
- No content follows: /html/body/h2 | ||
- No content follows: /html/body/h4 | ||
|
||
For details on how to fix these errors, please see the following pages: | ||
- http://www.bbc.co.uk/guidelines/futuremedia/accessibility/mobile/structure/headings | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,6 +141,18 @@ Feature: Headings | |
|
||
@html @automated | ||
Scenario: Subheading before the first main heading | ||
Given a page with the body: | ||
""" | ||
<h2>Heading 2a</h2> | ||
<h3>Heading 3</h3> | ||
<h1>Heading 1</h1> | ||
<h2>Heading 2b</h2> | ||
""" | ||
When I test the "Structure: Headings: Headings must be in ascending order" standard | ||
Then it passes | ||
|
||
@html @automated | ||
Scenario: Level 3 heading before the first main heading | ||
Given a page with the body: | ||
""" | ||
<h3>Ignore me</h3> | ||
|
@@ -150,7 +162,7 @@ Feature: Headings | |
When I test the "Structure: Headings: Headings must be in ascending order" standard | ||
Then it passes with the warning: | ||
""" | ||
First heading was not a main heading: /html/body/h3 | ||
First heading was not a level 1 or level 2 heading: /html/body/h3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not in keeping with the guidance. The requirement is for only one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Just to double-check that: I can get on board with the h1 not being the first heading in the page, keeping a h2 for Accessibility links and saving the h1 for the actual page content. That makes sense to me. But if we were to arbitrarily use a h3, h4, h5 or h6 as the first heading in the page, that stops making sense! Is that not worth scanning for and warning against? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also agree with @ChrisBAshton. However, it's true that there isn't really any guidance on this, and the passage in the HTML specification for sections and headings isn't even implemented in browsers (referring to the 'outline algorithm'). In an ideal world, the main article/content heading be determined by the fact that it's the top-level headline in the There's a big discussion around this at the WHATWG; see whatwg/html#3499 But it's going to be years since we have a definitive resolution to this issue. Maybe recommending hierarchy before the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand where you're coming from @ChrisBAshton but the one errant subheading in Orb could be an And this isn't trying to set any kind of precedent, as the WCAG guideline is different again in its requirements. This is simply dealing with the BBC situation and guideline. @JoshTumath the guideline to have one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
My opinion is that we should encourage users of the bbc-a11y tool to use the ignore functionality in cases like that, rather than changing the logic. (But in the case of Orbit, it always seems to stick to using Actually, my opinion is changing on this. The W3C guidelines on this seem contradictory or ambiguous in terms of how strict we need to be with the heading hierarchy. If we were to change the logic so that we don't test the heading hierarchy before the |
||
""" | ||
|
||
@html @automated | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,6 @@ | |
<body> | ||
<p role="main"> | ||
<!-- there is no content following the heading below --> | ||
<h2>This is the main heading, but it's not an H1</h2> | ||
<h4>This is the main heading, but it's not an H1 or H2</h4> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this an example of no |
||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
var headingSelector = 'h1, h2, h3, h4, h5, h6, h7, h8' | ||
var headingSelector = 'h1, h2, h3, h4, h5, h6' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for fixing these 👍 |
||
var iframeSelector = 'iframe:visible' | ||
|
||
var NODE_IS_FINE = 'node-is-fine' | ||
|
@@ -9,7 +9,7 @@ module.exports = { | |
|
||
type: 'automated', | ||
|
||
failsForEach: 'heading element (<h1> up to <h8>) that has no text content after it. ' + | ||
failsForEach: 'heading element (<h1> up to <h6>) that has no text content after it. ' + | ||
'Text elements may appear as children or descendants of subsequent siblings', | ||
|
||
test: function ({ $, fail }) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be better to remove this test, rather than be specific about what level the first heading is.