Skip to content

Commit

Permalink
fix(header-present): fail for headings with non-header role (#2306)
Browse files Browse the repository at this point in the history
  • Loading branch information
straker committed Jun 18, 2020
1 parent 58c8175 commit b8ffb39
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/checks/navigation/header-present.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "header-present",
"evaluate": "has-descendant-evaluate",
"options": {
"selector": "h1, h2, h3, h4, h5, h6, [role=heading]"
"selector": "h1:not([role]), h2:not([role]), h3:not([role]), h4:not([role]), h5:not([role]), h6:not([role]), [role=heading]"
},
"metadata": {
"impact": "serious",
Expand Down
11 changes: 11 additions & 0 deletions test/checks/navigation/header-present.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ describe('header-present', function() {
);
});

it('should return false if heading has a different role', function() {
var params = checkSetup(
'<h1 role="none" id="target">Some stuff and stuff</h1>'
);
assert.isFalse(
axe.testUtils
.getCheckEvaluate('header-present')
.apply(checkContext, params)
);
});

(shadowSupported ? it : xit)(
'should return true if heading is in shadow dom',
function() {
Expand Down

0 comments on commit b8ffb39

Please sign in to comment.