-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] Add a11y rule to check no tabindex in nointeractive element (#…
…6693) * [feature] add util module to check element is interactive element * [feature] add util module to check role is interactive role * [feature] add a11y checker for no-nointeractive-tabindex * [chore] add test for no-nointeractive-tabindex * [chore] fix tabindex-no-positive test div -> button * [refactor] bundle up two filter into one * Refactor: export a11y-no-nointeractive-tabindex warning from compiler_warning * slight refactor to use existing utils Co-authored-by: tanhauhau <lhtan93@gmail.com>
- Loading branch information
1 parent
7331c06
commit 2cd6611
Showing
7 changed files
with
102 additions
and
11 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
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
14 changes: 14 additions & 0 deletions
14
test/validator/samples/a11y-no-nointeractive-tabindex/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,14 @@ | ||
<!-- valid --> | ||
<button /> | ||
<button tabindex='0' /> | ||
<button tabindex='{0}' /> | ||
<div /> | ||
<div tabindex='-1' /> | ||
<div role='button' tabindex='0' /> | ||
<div role='article' tabindex='-1' /> | ||
<article tabindex='-1' /> | ||
<!-- invalid --> | ||
<div tabindex='0' /> | ||
<div role='article' tabindex='0' /> | ||
<article tabindex='0' /> | ||
<article tabindex='{0}' /> |
62 changes: 62 additions & 0 deletions
62
test/validator/samples/a11y-no-nointeractive-tabindex/warnings.json
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,62 @@ | ||
[ | ||
{ | ||
"code": "a11y-no-nointeractive-tabindex", | ||
"end": { | ||
"character": 241, | ||
"column": 20, | ||
"line": 11 | ||
}, | ||
"message": "A11y: not interactive element cannot have positive tabIndex value", | ||
"pos": 221, | ||
"start": { | ||
"character": 221, | ||
"column": 0, | ||
"line": 11 | ||
} | ||
}, | ||
{ | ||
"code": "a11y-no-nointeractive-tabindex", | ||
"end": { | ||
"character": 277, | ||
"column": 35, | ||
"line": 12 | ||
}, | ||
"message": "A11y: not interactive element cannot have positive tabIndex value", | ||
"pos": 242, | ||
"start": { | ||
"character": 242, | ||
"column": 0, | ||
"line": 12 | ||
} | ||
}, | ||
{ | ||
"code": "a11y-no-nointeractive-tabindex", | ||
"end": { | ||
"character": 302, | ||
"column": 24, | ||
"line": 13 | ||
}, | ||
"message": "A11y: not interactive element cannot have positive tabIndex value", | ||
"pos": 278, | ||
"start": { | ||
"character": 278, | ||
"column": 0, | ||
"line": 13 | ||
} | ||
}, | ||
{ | ||
"code": "a11y-no-nointeractive-tabindex", | ||
"end": { | ||
"character": 329, | ||
"column": 26, | ||
"line": 14 | ||
}, | ||
"message": "A11y: not interactive element cannot have positive tabIndex value", | ||
"pos": 303, | ||
"start": { | ||
"character": 303, | ||
"column": 0, | ||
"line": 14 | ||
} | ||
} | ||
] |
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