Skip to content
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
3 changes: 2 additions & 1 deletion packages/svelte/src/compiler/compile/utils/a11y.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const non_interactive_roles = new Set(
// aria-activedescendant, thus in practice we treat it as a widget.
// focusable tabpanel elements are recommended if any panels in a set contain content where the first element in the panel is not focusable.
// 'generic' is meant to have no semantic meaning.
!['toolbar', 'tabpanel', 'generic'].includes(name) &&
// 'cell' is treated as CellRole by the AXObject which is interactive, so we treat 'cell' it as interactive as well.
!['toolbar', 'tabpanel', 'generic', 'cell'].includes(name) &&
!role.superClass.some((classes) => classes.includes('widget'))
);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,37 @@
<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"/>
<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"/>
<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"/>
<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" />

<!-- HTML elements attributed with an abstract role -->
<div role="command" />
Expand Down Expand Up @@ -99,6 +99,7 @@
<div role="tab" />
<div role="textbox" />
<div role="treeitem" aria-selected={true} />
<summary role="listitem" />

<!-- HTML elements attributed with a non-interactive role -->
<div role="alert" />
Expand Down Expand Up @@ -143,6 +144,5 @@
<menuitem role="listitem" />
<option class="foo" role="listitem" />
<select class="foo" role="listitem" />
<summary role="listitem" /> // TODO: https://github.com/sveltejs/svelte/issues/8728
<textarea class="foo" role="listitem" />
<tr role="listitem" />
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 23,
"column": 24,
"line": 24
},
"message": "A11y: <input> cannot have role 'article'",
Expand All @@ -218,7 +218,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 22,
"column": 23,
"line": 25
},
"message": "A11y: <input> cannot have role 'banner'",
Expand All @@ -230,7 +230,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 29,
"column": 30,
"line": 26
},
"message": "A11y: <input> cannot have role 'complementary'",
Expand All @@ -242,7 +242,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 19,
"column": 20,
"line": 27
},
"message": "A11y: <input> cannot have role 'img'",
Expand All @@ -254,7 +254,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 24,
"column": 25,
"line": 28
},
"message": "A11y: <input> cannot have role 'listitem'",
Expand All @@ -266,7 +266,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 20,
"column": 21,
"line": 29
},
"message": "A11y: <input> cannot have role 'main'",
Expand All @@ -278,7 +278,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 22,
"column": 23,
"line": 30
},
"message": "A11y: <input> cannot have role 'region'",
Expand All @@ -290,7 +290,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 23,
"column": 24,
"line": 31
},
"message": "A11y: <input> cannot have role 'tooltip'",
Expand All @@ -302,7 +302,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 24,
"column": 25,
"line": 35
},
"message": "A11y: <select> cannot have role 'article'",
Expand All @@ -314,7 +314,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 23,
"column": 24,
"line": 36
},
"message": "A11y: <select> cannot have role 'banner'",
Expand All @@ -326,7 +326,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 30,
"column": 31,
"line": 37
},
"message": "A11y: <select> cannot have role 'complementary'",
Expand All @@ -338,7 +338,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 20,
"column": 21,
"line": 38
},
"message": "A11y: <select> cannot have role 'img'",
Expand All @@ -350,7 +350,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 25,
"column": 26,
"line": 39
},
"message": "A11y: <select> cannot have role 'listitem'",
Expand All @@ -362,7 +362,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 21,
"column": 22,
"line": 40
},
"message": "A11y: <select> cannot have role 'main'",
Expand All @@ -374,7 +374,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 23,
"column": 24,
"line": 41
},
"message": "A11y: <select> cannot have role 'region'",
Expand All @@ -386,7 +386,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 24,
"column": 25,
"line": 42
},
"message": "A11y: <select> cannot have role 'tooltip'",
Expand All @@ -398,7 +398,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 26,
"column": 27,
"line": 46
},
"message": "A11y: <textarea> cannot have role 'article'",
Expand All @@ -410,7 +410,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 25,
"column": 26,
"line": 47
},
"message": "A11y: <textarea> cannot have role 'banner'",
Expand All @@ -422,7 +422,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 32,
"column": 33,
"line": 48
},
"message": "A11y: <textarea> cannot have role 'complementary'",
Expand All @@ -434,7 +434,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 22,
"column": 23,
"line": 49
},
"message": "A11y: <textarea> cannot have role 'img'",
Expand All @@ -446,7 +446,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 27,
"column": 28,
"line": 50
},
"message": "A11y: <textarea> cannot have role 'listitem'",
Expand All @@ -458,7 +458,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 23,
"column": 24,
"line": 51
},
"message": "A11y: <textarea> cannot have role 'main'",
Expand All @@ -470,7 +470,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 25,
"column": 26,
"line": 52
},
"message": "A11y: <textarea> cannot have role 'region'",
Expand All @@ -482,7 +482,7 @@
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 26,
"column": 27,
"line": 53
},
"message": "A11y: <textarea> cannot have role 'tooltip'",
Expand Down Expand Up @@ -639,36 +639,36 @@
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 28,
"line": 143
"line": 144
},
"message": "A11y: <menuitem> cannot have role 'listitem'",
"start": {
"column": 0,
"line": 143
"line": 144
}
},
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 38,
"line": 144
"line": 145
},
"message": "A11y: <option> cannot have role 'listitem'",
"start": {
"column": 0,
"line": 144
"line": 145
}
},
{
"code": "a11y-no-interactive-element-to-noninteractive-role",
"end": {
"column": 38,
"line": 145
"line": 146
},
"message": "A11y: <select> cannot have role 'listitem'",
"start": {
"column": 0,
"line": 145
"line": 146
}
},
{
Expand Down
Loading