Skip to content

Commit aca0eab

Browse files
committed
Adding no-noninteractive-tabindex to README
1 parent ec15691 commit aca0eab

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ You can also enable all the recommended rules at once. Add `plugin:jsx-a11y/reco
116116
- [no-interactive-element-to-noninteractive-role](docs/rules/no-interactive-element-to-noninteractive-role.md): Interactive elements should not be assigned non-interactive roles.
117117
- [no-noninteractive-element-interactions](docs/rules/no-noninteractive-element-interactions.md): Non-interactive elements should not be assigned mouse or keyboard event listeners.
118118
- [no-noninteractive-element-to-interactive-role](docs/rules/no-noninteractive-element-to-interactive-role.md): Non-interactive elements should not be assigned interactive roles.
119+
- [no-noninteractive-tabindex](docs/rules/no-noninteractive-tabindex.md): `tabIndex` should only be declared on interactive elements.
119120
- [no-onchange](docs/rules/no-onchange.md): Enforce usage of `onBlur` over `onChange` on select menus for accessibility.
120121
- [no-redundant-roles](docs/rules/no-redundant-roles.md): Enforce explicit role property is not the same as implicit/default role property on element.
121122
- [no-static-element-interactions](docs/rules/no-static-element-interactions.md): Enforce that non-interactive, visible elements (such as `<div>`) that have click handlers use the role attribute.

__tests__/src/rules/no-noninteractive-tabindex-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import rule from '../../../src/rules/no-noninteractive-tabindex';
1919
const ruleTester = new RuleTester();
2020

2121
const expectedError = {
22-
message: 'TabIndex should only be declared on interactive elements.',
22+
message: '`tabIndex` should only be declared on interactive elements.',
2323
type: 'JSXAttribute',
2424
};
2525

@@ -38,8 +38,8 @@ const alwaysValid = [
3838
const neverValid = [
3939
{ code: '<div tabIndex="0" />', errors: [expectedError] },
4040
{ code: '<div role="article" tabIndex="0" />', errors: [expectedError] },
41-
{ code: '<article tabIndex="0" />', errors: [expectedError] },
42-
{ code: '<article tabIndex={0} />', errors: [expectedError] },
41+
{ code: '<article tabIndex="0" />', errors: [expectedError] },
42+
{ code: '<article tabIndex={0} />', errors: [expectedError] },
4343
];
4444

4545
ruleTester.run('no-noninteractive-tabindex', rule, {

src/rules/no-noninteractive-tabindex.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import isInteractiveRole from '../util/isInteractiveRole';
2222
import { generateObjSchema } from '../util/schemas';
2323

2424
const errorMessage =
25-
'TabIndex should only be declared on interactive elements.';
25+
'`tabIndex` should only be declared on interactive elements.';
2626

2727
const schema = generateObjSchema();
2828

0 commit comments

Comments
 (0)