Skip to content

Fix aria-level error for the heading role (#704) #705

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

Merged
merged 2 commits into from
Jun 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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