update docs for a11y-no-noninteractive-tabindex and rename from a11y-no-nointeractive-tabindex -> a11y-no-noninteractive-tabindex

pull/7838/head
tanhauhau 3 years ago
parent 2cd661156e
commit 899d0cc67c

@ -250,6 +250,17 @@ Some HTML elements have default ARIA roles. Giving these elements an ARIA role t
--- ---
### `a11y-no-noninteractive-tabindex`
Tab key navigation should be limited to elements on the page that can be interacted with.
```sv
<!-- A11y: not interactive element cannot have positive tabIndex value -->
<div tabindex='0' />
```
---
### `a11y-positive-tabindex` ### `a11y-positive-tabindex`
Avoid positive `tabindex` property values. This will move elements out of the expected tab order, creating a confusing experience for keyboard users. Avoid positive `tabindex` property values. This will move elements out of the expected tab order, creating a confusing experience for keyboard users.

@ -179,8 +179,8 @@ export default {
code: 'a11y-missing-content', code: 'a11y-missing-content',
message: `A11y: <${name}> element should have child content` message: `A11y: <${name}> element should have child content`
}), }),
a11y_no_nointeractive_tabindex: { a11y_no_noninteractive_tabindex: {
code: 'a11y-no-nointeractive-tabindex', code: 'a11y-no-noninteractive-tabindex',
message: 'A11y: not interactive element cannot have positive tabIndex value' message: 'A11y: not interactive element cannot have positive tabIndex value'
}, },
redundant_event_modifier_for_touch: { redundant_event_modifier_for_touch: {

@ -550,11 +550,11 @@ export default class Element extends Node {
} }
}); });
// no-nointeractive-tabindex // no-noninteractive-tabindex
if (!is_interactive_element(this.name, attribute_map) && !is_interactive_roles(attribute_map.get('role')?.get_static_value() as ARIARoleDefintionKey)) { if (!is_interactive_element(this.name, attribute_map) && !is_interactive_roles(attribute_map.get('role')?.get_static_value() as ARIARoleDefintionKey)) {
const tab_index = attribute_map.get('tabindex'); const tab_index = attribute_map.get('tabindex');
if (tab_index && (!tab_index.is_static || Number(tab_index.get_static_value()) >= 0)) { if (tab_index && (!tab_index.is_static || Number(tab_index.get_static_value()) >= 0)) {
component.warn(this, compiler_warnings.a11y_no_nointeractive_tabindex); component.warn(this, compiler_warnings.a11y_no_noninteractive_tabindex);
} }
} }
} }

@ -1,6 +1,6 @@
[ [
{ {
"code": "a11y-no-nointeractive-tabindex", "code": "a11y-no-noninteractive-tabindex",
"end": { "end": {
"character": 241, "character": 241,
"column": 20, "column": 20,
@ -15,7 +15,7 @@
} }
}, },
{ {
"code": "a11y-no-nointeractive-tabindex", "code": "a11y-no-noninteractive-tabindex",
"end": { "end": {
"character": 277, "character": 277,
"column": 35, "column": 35,
@ -30,7 +30,7 @@
} }
}, },
{ {
"code": "a11y-no-nointeractive-tabindex", "code": "a11y-no-noninteractive-tabindex",
"end": { "end": {
"character": 302, "character": 302,
"column": 24, "column": 24,
@ -45,7 +45,7 @@
} }
}, },
{ {
"code": "a11y-no-nointeractive-tabindex", "code": "a11y-no-noninteractive-tabindex",
"end": { "end": {
"character": 329, "character": 329,
"column": 26, "column": 26,

Loading…
Cancel
Save