mirror of https://github.com/sveltejs/svelte
[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>pull/7838/head
parent
7331c06a74
commit
2cd661156e
@ -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}' />
|
@ -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
|
||||
}
|
||||
}
|
||||
]
|
Loading…
Reference in new issue