-
-
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-no-static-element-interactions
compiler rule (#8251)
Ref: #820
- Loading branch information
1 parent
56a6738
commit 9460616
Showing
14 changed files
with
135 additions
and
31 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
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
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
18 changes: 18 additions & 0 deletions
18
test/validator/samples/a11y-no-static-element-interactions/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,18 @@ | ||
<script> | ||
const dynamicRole = "button"; | ||
</script> | ||
|
||
<!-- valid --> | ||
<button on:click={() => {}} /> | ||
<!-- svelte-ignore a11y-interactive-supports-focus --> | ||
<div on:keydown={() => {}} role="button" /> | ||
<input type="text" on:click={() => {}} /> | ||
<div on:copy={() => {}} /> | ||
<a href="/foo" on:click={() => {}}>link</a> | ||
<div role={dynamicRole} on:click={() => {}} /> | ||
<footer on:keydown={() => {}} /> | ||
|
||
<!-- invalid --> | ||
<div on:keydown={() => {}} /> | ||
<!-- svelte-ignore a11y-missing-attribute --> | ||
<a on:mousedown={() => {}} on:mouseup={() => {}} on:copy={() => {}}>link</a> |
26 changes: 26 additions & 0 deletions
26
test/validator/samples/a11y-no-static-element-interactions/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,26 @@ | ||
[ | ||
{ | ||
"code": "a11y-no-static-element-interactions", | ||
"end": { | ||
"column": 29, | ||
"line": 16 | ||
}, | ||
"message": "A11y: <div> with keydown handler must have an ARIA role", | ||
"start": { | ||
"column": 0, | ||
"line": 16 | ||
} | ||
}, | ||
{ | ||
"code": "a11y-no-static-element-interactions", | ||
"end": { | ||
"column": 76, | ||
"line": 18 | ||
}, | ||
"message": "A11y: <a> with mousedown, mouseup handlers must have an ARIA role", | ||
"start": { | ||
"column": 0, | ||
"line": 18 | ||
} | ||
} | ||
] |
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
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
Oops, something went wrong.