Skip to content

Commit bde7727

Browse files
authored
Merge branch 'master' into fix/doc-deprecation
2 parents 3844248 + 7c53b60 commit bde7727

File tree

6 files changed

+16
-22
lines changed

6 files changed

+16
-22
lines changed

__tests__/src/rules/label-has-associated-control-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const bothValid = [
6363
{ code: '<CustomLabel htmlFor="js_id" label="A label"><input /></CustomLabel>', options: [{ labelAttributes: ['label'], labelComponents: ['CustomLabel'] }] },
6464
// Custom label attributes.
6565
{ code: '<label htmlFor="js_id" label="A label"><input /></label>', options: [{ labelAttributes: ['label'] }] },
66+
{ code: '<label htmlFor="selectInput">Some text<select id="selectInput" /></label>' },
6667
];
6768

6869
const alwaysValid = [

__tests__/src/rules/role-supports-aria-props-test.js

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -141,23 +141,8 @@ ruleTester.run('role-supports-aria-props', rule, {
141141
// this will have global
142142
{ code: '<link aria-checked />' },
143143

144-
// IMG TESTS - implicit role is `presentation`
145-
{ code: '<img alt="" aria-atomic />' },
146-
{ code: '<img alt="" aria-busy />' },
147-
{ code: '<img alt="" aria-controls />' },
148-
{ code: '<img alt="" aria-describedby />' },
149-
{ code: '<img alt="" aria-disabled />' },
150-
{ code: '<img alt="" aria-dropeffect />' },
151-
{ code: '<img alt="" aria-flowto />' },
152-
{ code: '<img alt="" aria-grabbed />' },
153-
{ code: '<img alt="" aria-haspopup />' },
154-
{ code: '<img alt="" aria-hidden />' },
155-
{ code: '<img alt="" aria-invalid />' },
156-
{ code: '<img alt="" aria-label />' },
157-
{ code: '<img alt="" aria-labelledby />' },
158-
{ code: '<img alt="" aria-live />' },
159-
{ code: '<img alt="" aria-owns />' },
160-
{ code: '<img alt="" aria-relevant />' },
144+
// IMG TESTS - no implicit role
145+
{ code: '<img alt="" aria-checked />' },
161146

162147
// this will have role of `img`
163148
{ code: '<img alt="foobar" aria-busy />' },
@@ -444,8 +429,8 @@ ruleTester.run('role-supports-aria-props', rule, {
444429
errors: [errorMessage('aria-checked', 'link', 'link', true)],
445430
},
446431
{
447-
code: '<img alt="" aria-checked />',
448-
errors: [errorMessage('aria-checked', 'presentation', 'img', true)],
432+
code: '<img alt="foobar" aria-checked />',
433+
errors: [errorMessage('aria-checked', 'img', 'img', true)],
449434
},
450435
{
451436
code: '<menu type="toolbar" aria-checked />',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"eslint-plugin-import": "^2.13.0",
4747
"estraverse": "^4.2.0",
4848
"expect": "^21.2.1",
49-
"flow-bin": "^0.66.0",
49+
"flow-bin": "^0.87.0",
5050
"in-publish": "^2.0.0",
5151
"jest": "^21.2.1",
5252
"jscodeshift": "^0.4.0",

src/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ module.exports = {
3939
},
4040
configs: {
4141
recommended: {
42+
plugins: [
43+
'jsx-a11y',
44+
],
4245
parserOptions: {
4346
ecmaFeatures: {
4447
jsx: true,
@@ -100,7 +103,9 @@ module.exports = {
100103
'onKeyDown',
101104
'onKeyUp',
102105
],
106+
alert: ['onKeyUp', 'onKeyDown', 'onKeyPress'],
103107
body: ['onError', 'onLoad'],
108+
dialog: ['onKeyUp', 'onKeyDown', 'onKeyPress'],
104109
iframe: ['onError', 'onLoad'],
105110
img: ['onError', 'onLoad'],
106111
},
@@ -160,6 +165,9 @@ module.exports = {
160165
},
161166
},
162167
strict: {
168+
plugins: [
169+
'jsx-a11y',
170+
],
163171
parserOptions: {
164172
ecmaFeatures: {
165173
jsx: true,

src/rules/label-has-associated-control.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module.exports = {
5757
if (componentNames.indexOf(elementType(node.openingElement)) === -1) {
5858
return;
5959
}
60-
const controlComponents = ['input', 'textarea'].concat((options.controlComponents || []));
60+
const controlComponents = ['input', 'select', 'textarea'].concat((options.controlComponents || []));
6161
// Prevent crazy recursion.
6262
const recursionDepth = Math.min(
6363
options.depth === undefined ? 2 : options.depth,

src/util/implicitRoles/img.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default function getImplicitRoleForImg(attributes) {
77
const alt = getProp(attributes, 'alt');
88

99
if (alt && getLiteralPropValue(alt) === '') {
10-
return 'presentation';
10+
return '';
1111
}
1212

1313
return 'img';

0 commit comments

Comments
 (0)