Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check noninteractive roles on interactive elements
- Loading branch information
1 parent
ccbf10c
commit 751d927
Showing
5 changed files
with
684 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { roles as rolesMap } from 'aria-query'; | ||
|
||
const roles = [...rolesMap.keys()]; | ||
|
||
const noninteractive_roles = new Set(roles | ||
.filter((name) => !rolesMap.get(name).abstract) | ||
.filter((name) => !rolesMap.get(name).superClass.some((c) => c.includes('widget')))); | ||
|
||
export { noninteractive_roles }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const interactive_elements = new Set([ | ||
'a', 'button', 'input', 'select', 'textarea' | ||
]); | ||
|
||
export { interactive_elements }; |
54 changes: 54 additions & 0 deletions
54
test/validator/samples/a11y-no-interactive-element-to-noninteractive-role/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<!-- a --> | ||
<a href="test" role="article">link</a> | ||
<a href="test" role="banner">link</a> | ||
<a href="test" role="complementary">link</a> | ||
<a href="test" role="img">link</a> | ||
<a href="test" role="listitem">link</a> | ||
<a href="test" role="main">link</a> | ||
<a href="test" role="region">link</a> | ||
<a href="test" role="tooltip">link</a> | ||
<a href="test" role="button">link</a> | ||
|
||
<!-- button --> | ||
<button role="article">button</button> | ||
<button role="banner">button</button> | ||
<button role="complementary">button</button> | ||
<button role="img">button</button> | ||
<button role="listitem">button</button> | ||
<button role="main">button</button> | ||
<button role="region">button</button> | ||
<button role="tooltip">button</button> | ||
<button role="button">button</button> | ||
|
||
<!-- input --> | ||
<input role="article"/> | ||
<input role="banner"/> | ||
<input role="complementary"/> | ||
<input role="img"/> | ||
<input role="listitem"/> | ||
<input role="main"/> | ||
<input role="region"/> | ||
<input role="tooltip"/> | ||
<input role="button"/> | ||
|
||
<!-- select --> | ||
<select role="article"/> | ||
<select role="banner"/> | ||
<select role="complementary"/> | ||
<select role="img"/> | ||
<select role="listitem"/> | ||
<select role="main"/> | ||
<select role="region"/> | ||
<select role="tooltip"/> | ||
<select role="button"/> | ||
|
||
<!-- textarea --> | ||
<textarea role="article"/> | ||
<textarea role="banner"/> | ||
<textarea role="complementary"/> | ||
<textarea role="img"/> | ||
<textarea role="listitem"/> | ||
<textarea role="main"/> | ||
<textarea role="region"/> | ||
<textarea role="tooltip"/> | ||
<textarea role="button"/> |
Oops, something went wrong.