Skip to content

Commit

Permalink
Merge pull request #705 from jsx-eslint/fix-heading-error
Browse files Browse the repository at this point in the history
Fix aria-level error for the heading role (#704)
  • Loading branch information
jessebeach authored Jun 19, 2020
2 parents 3ac1738 + 765da0f commit b82b1bd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions __tests__/src/rules/role-supports-aria-props-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ ruleTester.run('role-supports-aria-props', rule, {
{ code: '<textarea aria-hidden />' },
{ code: '<select aria-expanded />' },
{ code: '<datalist aria-expanded />' },
{ code: '<div role="heading" aria-level />' },
{ code: '<div role="heading" aria-level="1" />' },

].concat(validTests).map(parserOptionsMapper),

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.10.2",
"aria-query": "^4.2.0",
"aria-query": "^4.2.2",
"array-includes": "^3.1.1",
"ast-types-flow": "^0.0.7",
"axe-core": "^3.5.4",
Expand Down
7 changes: 7 additions & 0 deletions src/util/isNonInteractiveElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ const isNonInteractiveElement = (
if (!dom.has(tagName)) {
return false;
}
// <header> elements do not technically have semantics, unless the
// element is a direct descendant of <body>, and this plugin cannot
// reliably test that.
// @see https://www.w3.org/TR/wai-aria-practices/examples/landmarks/banner.html
if (tagName === 'header') {
return false;
}

return checkIsNonInteractiveElement(tagName, attributes);
};
Expand Down

0 comments on commit b82b1bd

Please sign in to comment.