@arcaauth/eslint-plugin-jsx-a11y 6.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +17 -0
- package/.eslintrc +44 -0
- package/CHANGELOG.md +774 -0
- package/LICENSE.md +8 -0
- package/README.md +423 -0
- package/__mocks__/IdentifierMock.js +15 -0
- package/__mocks__/JSXAttributeMock.js +39 -0
- package/__mocks__/JSXElementMock.js +37 -0
- package/__mocks__/JSXExpressionContainerMock.js +15 -0
- package/__mocks__/JSXSpreadAttributeMock.js +18 -0
- package/__mocks__/JSXTextMock.js +17 -0
- package/__mocks__/LiteralMock.js +17 -0
- package/__mocks__/genInteractives.js +218 -0
- package/__tests__/__util__/axeMapping.js +6 -0
- package/__tests__/__util__/helpers/getESLintCoreRule.js +9 -0
- package/__tests__/__util__/helpers/parsers.js +186 -0
- package/__tests__/__util__/parserOptionsMapper.js +53 -0
- package/__tests__/__util__/ruleOptionsMapperFactory.js +33 -0
- package/__tests__/index-test.js +40 -0
- package/__tests__/src/rules/accessible-emoji-test.js +66 -0
- package/__tests__/src/rules/alt-text-test.js +291 -0
- package/__tests__/src/rules/anchor-ambiguous-text-test.js +117 -0
- package/__tests__/src/rules/anchor-has-content-test.js +54 -0
- package/__tests__/src/rules/anchor-is-valid-test.js +532 -0
- package/__tests__/src/rules/aria-activedescendant-has-tabindex-test.js +95 -0
- package/__tests__/src/rules/aria-props-test.js +69 -0
- package/__tests__/src/rules/aria-proptypes-test.js +311 -0
- package/__tests__/src/rules/aria-role-test.js +118 -0
- package/__tests__/src/rules/aria-unsupported-elements-test.js +75 -0
- package/__tests__/src/rules/autocomplete-valid-test.js +77 -0
- package/__tests__/src/rules/click-events-have-key-events-test.js +77 -0
- package/__tests__/src/rules/control-has-associated-label-test.js +327 -0
- package/__tests__/src/rules/heading-has-content-test.js +85 -0
- package/__tests__/src/rules/html-has-lang-test.js +42 -0
- package/__tests__/src/rules/iframe-has-title-test.js +55 -0
- package/__tests__/src/rules/img-redundant-alt-test.js +137 -0
- package/__tests__/src/rules/interactive-supports-focus-test.js +267 -0
- package/__tests__/src/rules/label-has-associated-control-test.js +243 -0
- package/__tests__/src/rules/label-has-for-test.js +235 -0
- package/__tests__/src/rules/lang-test.js +59 -0
- package/__tests__/src/rules/media-has-caption-test.js +220 -0
- package/__tests__/src/rules/mouse-events-have-key-events-test.js +154 -0
- package/__tests__/src/rules/no-access-key-test.js +48 -0
- package/__tests__/src/rules/no-aria-hidden-on-focusable-test.js +44 -0
- package/__tests__/src/rules/no-autofocus-test.js +68 -0
- package/__tests__/src/rules/no-distracting-elements-test.js +51 -0
- package/__tests__/src/rules/no-interactive-element-to-noninteractive-role-test.js +405 -0
- package/__tests__/src/rules/no-noninteractive-element-interactions-test.js +502 -0
- package/__tests__/src/rules/no-noninteractive-element-to-interactive-role-test.js +500 -0
- package/__tests__/src/rules/no-noninteractive-tabindex-test.js +123 -0
- package/__tests__/src/rules/no-onchange-test.js +57 -0
- package/__tests__/src/rules/no-redundant-roles-test.js +98 -0
- package/__tests__/src/rules/no-static-element-interactions-test.js +501 -0
- package/__tests__/src/rules/prefer-tag-over-role-test.js +63 -0
- package/__tests__/src/rules/role-has-required-aria-props-test.js +134 -0
- package/__tests__/src/rules/role-supports-aria-props-test.js +570 -0
- package/__tests__/src/rules/scope-test.js +50 -0
- package/__tests__/src/rules/tabindex-no-positive-test.js +55 -0
- package/__tests__/src/util/attributesComparator-test.js +91 -0
- package/__tests__/src/util/getAccessibleChildText-test.js +174 -0
- package/__tests__/src/util/getComputedRole-test.js +71 -0
- package/__tests__/src/util/getElementType-test.js +154 -0
- package/__tests__/src/util/getExplicitRole-test.js +35 -0
- package/__tests__/src/util/getImplicitRole-test.js +25 -0
- package/__tests__/src/util/getSuggestion-test.js +33 -0
- package/__tests__/src/util/getTabIndex-test.js +85 -0
- package/__tests__/src/util/hasAccessibleChild-test.js +157 -0
- package/__tests__/src/util/implicitRoles/input-test.js +87 -0
- package/__tests__/src/util/implicitRoles/menu-test.js +20 -0
- package/__tests__/src/util/implicitRoles/menuitem-test.js +38 -0
- package/__tests__/src/util/isAbstractRole-test.js +51 -0
- package/__tests__/src/util/isContentEditable-test.js +52 -0
- package/__tests__/src/util/isDOMElement-test.js +30 -0
- package/__tests__/src/util/isDisabledElement-test.js +88 -0
- package/__tests__/src/util/isFocusable-test.js +111 -0
- package/__tests__/src/util/isInteractiveElement-test.js +104 -0
- package/__tests__/src/util/isInteractiveRole-test.js +59 -0
- package/__tests__/src/util/isNonInteractiveElement-test.js +97 -0
- package/__tests__/src/util/isNonInteractiveRole-test.js +59 -0
- package/__tests__/src/util/isNonLiteralProperty-test.js +52 -0
- package/__tests__/src/util/isSemanticRoleElement-test.js +72 -0
- package/__tests__/src/util/mayContainChildComponent-test.js +219 -0
- package/__tests__/src/util/mayHaveAccessibleLabel-test.js +256 -0
- package/__tests__/src/util/parserOptionsMapper-test.js +93 -0
- package/__tests__/src/util/schemas-test.js +35 -0
- package/docs/rules/accessible-emoji.md +30 -0
- package/docs/rules/alt-text.md +168 -0
- package/docs/rules/anchor-ambiguous-text.md +91 -0
- package/docs/rules/anchor-has-content.md +64 -0
- package/docs/rules/anchor-is-valid.md +270 -0
- package/docs/rules/aria-activedescendant-has-tabindex.md +52 -0
- package/docs/rules/aria-props.md +29 -0
- package/docs/rules/aria-proptypes.md +30 -0
- package/docs/rules/aria-role.md +51 -0
- package/docs/rules/aria-unsupported-elements.md +30 -0
- package/docs/rules/autocomplete-valid.md +49 -0
- package/docs/rules/click-events-have-key-events.md +28 -0
- package/docs/rules/control-has-associated-label.md +113 -0
- package/docs/rules/heading-has-content.md +67 -0
- package/docs/rules/html-has-lang.md +31 -0
- package/docs/rules/iframe-has-title.md +37 -0
- package/docs/rules/img-redundant-alt.md +48 -0
- package/docs/rules/interactive-supports-focus.md +156 -0
- package/docs/rules/label-has-associated-control.md +152 -0
- package/docs/rules/label-has-for.md +130 -0
- package/docs/rules/lang.md +31 -0
- package/docs/rules/media-has-caption.md +48 -0
- package/docs/rules/mouse-events-have-key-events.md +58 -0
- package/docs/rules/no-access-key.md +30 -0
- package/docs/rules/no-aria-hidden-on-focusable.md +37 -0
- package/docs/rules/no-autofocus.md +43 -0
- package/docs/rules/no-distracting-elements.md +41 -0
- package/docs/rules/no-interactive-element-to-noninteractive-role.md +73 -0
- package/docs/rules/no-noninteractive-element-interactions.md +145 -0
- package/docs/rules/no-noninteractive-element-to-interactive-role.md +76 -0
- package/docs/rules/no-noninteractive-tabindex.md +115 -0
- package/docs/rules/no-onchange.md +36 -0
- package/docs/rules/no-redundant-roles.md +46 -0
- package/docs/rules/no-static-element-interactions.md +114 -0
- package/docs/rules/prefer-tag-over-role.md +32 -0
- package/docs/rules/role-has-required-aria-props.md +31 -0
- package/docs/rules/role-supports-aria-props.md +39 -0
- package/docs/rules/scope.md +30 -0
- package/docs/rules/tabindex-no-positive.md +32 -0
- package/lib/configs/flat-config-base.js +11 -0
- package/lib/configs/legacy-config-base.js +9 -0
- package/lib/index.js +209 -0
- package/lib/rules/accessible-emoji.js +63 -0
- package/lib/rules/alt-text.js +218 -0
- package/lib/rules/anchor-ambiguous-text.js +64 -0
- package/lib/rules/anchor-has-content.js +60 -0
- package/lib/rules/anchor-is-valid.js +122 -0
- package/lib/rules/aria-activedescendant-has-tabindex.js +66 -0
- package/lib/rules/aria-props.js +59 -0
- package/lib/rules/aria-proptypes.js +114 -0
- package/lib/rules/aria-role.js +89 -0
- package/lib/rules/aria-unsupported-elements.js +64 -0
- package/lib/rules/autocomplete-valid.js +67 -0
- package/lib/rules/click-events-have-key-events.js +68 -0
- package/lib/rules/control-has-associated-label.js +103 -0
- package/lib/rules/heading-has-content.js +61 -0
- package/lib/rules/html-has-lang.js +50 -0
- package/lib/rules/iframe-has-title.js +50 -0
- package/lib/rules/img-redundant-alt.js +88 -0
- package/lib/rules/interactive-supports-focus.js +87 -0
- package/lib/rules/label-has-associated-control.js +127 -0
- package/lib/rules/label-has-for.js +150 -0
- package/lib/rules/lang.js +68 -0
- package/lib/rules/media-has-caption.js +96 -0
- package/lib/rules/mouse-events-have-key-events.js +94 -0
- package/lib/rules/no-access-key.js +43 -0
- package/lib/rules/no-aria-hidden-on-focusable.js +47 -0
- package/lib/rules/no-autofocus.js +62 -0
- package/lib/rules/no-distracting-elements.js +54 -0
- package/lib/rules/no-interactive-element-to-noninteractive-role.js +81 -0
- package/lib/rules/no-noninteractive-element-interactions.js +95 -0
- package/lib/rules/no-noninteractive-element-to-interactive-role.js +80 -0
- package/lib/rules/no-noninteractive-tabindex.js +109 -0
- package/lib/rules/no-onchange.js +52 -0
- package/lib/rules/no-redundant-roles.js +86 -0
- package/lib/rules/no-static-element-interactions.js +102 -0
- package/lib/rules/prefer-tag-over-role.js +75 -0
- package/lib/rules/role-has-required-aria-props.js +88 -0
- package/lib/rules/role-supports-aria-props.js +78 -0
- package/lib/rules/scope.js +58 -0
- package/lib/rules/tabindex-no-positive.js +53 -0
- package/lib/util/attributesComparator.js +34 -0
- package/lib/util/getAccessibleChildText.js +55 -0
- package/lib/util/getComputedRole.js +19 -0
- package/lib/util/getElementType.js +30 -0
- package/lib/util/getExplicitRole.js +27 -0
- package/lib/util/getImplicitRole.js +24 -0
- package/lib/util/getSuggestion.js +32 -0
- package/lib/util/getTabIndex.js +34 -0
- package/lib/util/hasAccessibleChild.js +30 -0
- package/lib/util/implicitRoles/a.js +17 -0
- package/lib/util/implicitRoles/area.js +17 -0
- package/lib/util/implicitRoles/article.js +13 -0
- package/lib/util/implicitRoles/aside.js +13 -0
- package/lib/util/implicitRoles/body.js +13 -0
- package/lib/util/implicitRoles/button.js +13 -0
- package/lib/util/implicitRoles/datalist.js +13 -0
- package/lib/util/implicitRoles/details.js +13 -0
- package/lib/util/implicitRoles/dialog.js +13 -0
- package/lib/util/implicitRoles/form.js +13 -0
- package/lib/util/implicitRoles/h1.js +13 -0
- package/lib/util/implicitRoles/h2.js +13 -0
- package/lib/util/implicitRoles/h3.js +13 -0
- package/lib/util/implicitRoles/h4.js +13 -0
- package/lib/util/implicitRoles/h5.js +13 -0
- package/lib/util/implicitRoles/h6.js +13 -0
- package/lib/util/implicitRoles/hr.js +13 -0
- package/lib/util/implicitRoles/img.js +31 -0
- package/lib/util/implicitRoles/index.js +82 -0
- package/lib/util/implicitRoles/input.js +38 -0
- package/lib/util/implicitRoles/li.js +13 -0
- package/lib/util/implicitRoles/link.js +17 -0
- package/lib/util/implicitRoles/menu.js +19 -0
- package/lib/util/implicitRoles/menuitem.js +28 -0
- package/lib/util/implicitRoles/meter.js +13 -0
- package/lib/util/implicitRoles/nav.js +13 -0
- package/lib/util/implicitRoles/ol.js +13 -0
- package/lib/util/implicitRoles/option.js +13 -0
- package/lib/util/implicitRoles/output.js +13 -0
- package/lib/util/implicitRoles/progress.js +13 -0
- package/lib/util/implicitRoles/section.js +13 -0
- package/lib/util/implicitRoles/select.js +13 -0
- package/lib/util/implicitRoles/tbody.js +13 -0
- package/lib/util/implicitRoles/textarea.js +13 -0
- package/lib/util/implicitRoles/tfoot.js +13 -0
- package/lib/util/implicitRoles/thead.js +13 -0
- package/lib/util/implicitRoles/ul.js +13 -0
- package/lib/util/isAbstractRole.js +23 -0
- package/lib/util/isContentEditable.js +13 -0
- package/lib/util/isDOMElement.js +15 -0
- package/lib/util/isDisabledElement.js +23 -0
- package/lib/util/isFocusable.js +23 -0
- package/lib/util/isHiddenFromScreenReader.js +26 -0
- package/lib/util/isInteractiveElement.js +116 -0
- package/lib/util/isInteractiveRole.js +54 -0
- package/lib/util/isNonInteractiveElement.js +131 -0
- package/lib/util/isNonInteractiveRole.js +55 -0
- package/lib/util/isNonLiteralProperty.js +29 -0
- package/lib/util/isPresentationRole.js +13 -0
- package/lib/util/isSemanticRoleElement.js +54 -0
- package/lib/util/mayContainChildComponent.js +50 -0
- package/lib/util/mayHaveAccessibleLabel.js +95 -0
- package/lib/util/schemas.js +52 -0
- package/package.json +120 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForArea;
|
|
7
|
+
var _jsxAstUtils = require("jsx-ast-utils");
|
|
8
|
+
/**
|
|
9
|
+
* Returns the implicit role for an area tag.
|
|
10
|
+
*/
|
|
11
|
+
function getImplicitRoleForArea(attributes) {
|
|
12
|
+
if ((0, _jsxAstUtils.getProp)(attributes, 'href')) {
|
|
13
|
+
return 'link';
|
|
14
|
+
}
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForArticle;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for an article tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForArticle() {
|
|
11
|
+
return 'article';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForAside;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for an aside tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForAside() {
|
|
11
|
+
return 'complementary';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForBody;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for a body tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForBody() {
|
|
11
|
+
return 'document';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForButton;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for a button tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForButton() {
|
|
11
|
+
return 'button';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForDatalist;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for a datalist tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForDatalist() {
|
|
11
|
+
return 'listbox';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForDetails;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for a details tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForDetails() {
|
|
11
|
+
return 'group';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForDialog;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for a dialog tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForDialog() {
|
|
11
|
+
return 'dialog';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForForm;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for a form tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForForm() {
|
|
11
|
+
return 'form';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForH1;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for an h1 tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForH1() {
|
|
11
|
+
return 'heading';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForH2;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for an h2 tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForH2() {
|
|
11
|
+
return 'heading';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForH3;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for an h3 tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForH3() {
|
|
11
|
+
return 'heading';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForH4;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for an h4 tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForH4() {
|
|
11
|
+
return 'heading';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForH5;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for an h5 tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForH5() {
|
|
11
|
+
return 'heading';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForH6;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for an h6tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForH6() {
|
|
11
|
+
return 'heading';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForHr;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for an hr tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForHr() {
|
|
11
|
+
return 'separator';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForImg;
|
|
7
|
+
var _jsxAstUtils = require("jsx-ast-utils");
|
|
8
|
+
/**
|
|
9
|
+
* Returns the implicit role for an img tag.
|
|
10
|
+
*/
|
|
11
|
+
function getImplicitRoleForImg(attributes) {
|
|
12
|
+
var _getLiteralPropValue;
|
|
13
|
+
var alt = (0, _jsxAstUtils.getProp)(attributes, 'alt');
|
|
14
|
+
if (alt && (0, _jsxAstUtils.getLiteralPropValue)(alt) === '') {
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* If the src attribute can be determined to be an svg, allow the role to be set to 'img'
|
|
20
|
+
* so that VoiceOver on Safari can be better supported.
|
|
21
|
+
*
|
|
22
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#identifying_svg_as_an_image
|
|
23
|
+
* @see https://bugs.webkit.org/show_bug.cgi?id=216364
|
|
24
|
+
*/
|
|
25
|
+
var src = (0, _jsxAstUtils.getProp)(attributes, 'src');
|
|
26
|
+
if (src && (_getLiteralPropValue = (0, _jsxAstUtils.getLiteralPropValue)(src)) !== null && _getLiteralPropValue !== void 0 && _getLiteralPropValue.includes('.svg')) {
|
|
27
|
+
return '';
|
|
28
|
+
}
|
|
29
|
+
return 'img';
|
|
30
|
+
}
|
|
31
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _a = _interopRequireDefault(require("./a"));
|
|
8
|
+
var _area = _interopRequireDefault(require("./area"));
|
|
9
|
+
var _article = _interopRequireDefault(require("./article"));
|
|
10
|
+
var _aside = _interopRequireDefault(require("./aside"));
|
|
11
|
+
var _body = _interopRequireDefault(require("./body"));
|
|
12
|
+
var _button = _interopRequireDefault(require("./button"));
|
|
13
|
+
var _datalist = _interopRequireDefault(require("./datalist"));
|
|
14
|
+
var _details = _interopRequireDefault(require("./details"));
|
|
15
|
+
var _dialog = _interopRequireDefault(require("./dialog"));
|
|
16
|
+
var _form = _interopRequireDefault(require("./form"));
|
|
17
|
+
var _h = _interopRequireDefault(require("./h1"));
|
|
18
|
+
var _h2 = _interopRequireDefault(require("./h2"));
|
|
19
|
+
var _h3 = _interopRequireDefault(require("./h3"));
|
|
20
|
+
var _h4 = _interopRequireDefault(require("./h4"));
|
|
21
|
+
var _h5 = _interopRequireDefault(require("./h5"));
|
|
22
|
+
var _h6 = _interopRequireDefault(require("./h6"));
|
|
23
|
+
var _hr = _interopRequireDefault(require("./hr"));
|
|
24
|
+
var _img = _interopRequireDefault(require("./img"));
|
|
25
|
+
var _input = _interopRequireDefault(require("./input"));
|
|
26
|
+
var _li = _interopRequireDefault(require("./li"));
|
|
27
|
+
var _link = _interopRequireDefault(require("./link"));
|
|
28
|
+
var _menu = _interopRequireDefault(require("./menu"));
|
|
29
|
+
var _menuitem = _interopRequireDefault(require("./menuitem"));
|
|
30
|
+
var _meter = _interopRequireDefault(require("./meter"));
|
|
31
|
+
var _nav = _interopRequireDefault(require("./nav"));
|
|
32
|
+
var _ol = _interopRequireDefault(require("./ol"));
|
|
33
|
+
var _option = _interopRequireDefault(require("./option"));
|
|
34
|
+
var _output = _interopRequireDefault(require("./output"));
|
|
35
|
+
var _progress = _interopRequireDefault(require("./progress"));
|
|
36
|
+
var _section = _interopRequireDefault(require("./section"));
|
|
37
|
+
var _select = _interopRequireDefault(require("./select"));
|
|
38
|
+
var _tbody = _interopRequireDefault(require("./tbody"));
|
|
39
|
+
var _textarea = _interopRequireDefault(require("./textarea"));
|
|
40
|
+
var _tfoot = _interopRequireDefault(require("./tfoot"));
|
|
41
|
+
var _thead = _interopRequireDefault(require("./thead"));
|
|
42
|
+
var _ul = _interopRequireDefault(require("./ul"));
|
|
43
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
44
|
+
var _default = exports["default"] = {
|
|
45
|
+
a: _a["default"],
|
|
46
|
+
area: _area["default"],
|
|
47
|
+
article: _article["default"],
|
|
48
|
+
aside: _aside["default"],
|
|
49
|
+
body: _body["default"],
|
|
50
|
+
button: _button["default"],
|
|
51
|
+
datalist: _datalist["default"],
|
|
52
|
+
details: _details["default"],
|
|
53
|
+
dialog: _dialog["default"],
|
|
54
|
+
form: _form["default"],
|
|
55
|
+
h1: _h["default"],
|
|
56
|
+
h2: _h2["default"],
|
|
57
|
+
h3: _h3["default"],
|
|
58
|
+
h4: _h4["default"],
|
|
59
|
+
h5: _h5["default"],
|
|
60
|
+
h6: _h6["default"],
|
|
61
|
+
hr: _hr["default"],
|
|
62
|
+
img: _img["default"],
|
|
63
|
+
input: _input["default"],
|
|
64
|
+
li: _li["default"],
|
|
65
|
+
link: _link["default"],
|
|
66
|
+
menu: _menu["default"],
|
|
67
|
+
menuitem: _menuitem["default"],
|
|
68
|
+
meter: _meter["default"],
|
|
69
|
+
nav: _nav["default"],
|
|
70
|
+
ol: _ol["default"],
|
|
71
|
+
option: _option["default"],
|
|
72
|
+
output: _output["default"],
|
|
73
|
+
progress: _progress["default"],
|
|
74
|
+
section: _section["default"],
|
|
75
|
+
select: _select["default"],
|
|
76
|
+
tbody: _tbody["default"],
|
|
77
|
+
textarea: _textarea["default"],
|
|
78
|
+
tfoot: _tfoot["default"],
|
|
79
|
+
thead: _thead["default"],
|
|
80
|
+
ul: _ul["default"]
|
|
81
|
+
};
|
|
82
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForInput;
|
|
7
|
+
var _jsxAstUtils = require("jsx-ast-utils");
|
|
8
|
+
/**
|
|
9
|
+
* Returns the implicit role for an input tag.
|
|
10
|
+
*/
|
|
11
|
+
function getImplicitRoleForInput(attributes) {
|
|
12
|
+
var type = (0, _jsxAstUtils.getProp)(attributes, 'type');
|
|
13
|
+
if (type) {
|
|
14
|
+
var value = (0, _jsxAstUtils.getLiteralPropValue)(type) || '';
|
|
15
|
+
switch (typeof value === 'string' && value.toUpperCase()) {
|
|
16
|
+
case 'BUTTON':
|
|
17
|
+
case 'IMAGE':
|
|
18
|
+
case 'RESET':
|
|
19
|
+
case 'SUBMIT':
|
|
20
|
+
return 'button';
|
|
21
|
+
case 'CHECKBOX':
|
|
22
|
+
return 'checkbox';
|
|
23
|
+
case 'RADIO':
|
|
24
|
+
return 'radio';
|
|
25
|
+
case 'RANGE':
|
|
26
|
+
return 'slider';
|
|
27
|
+
case 'EMAIL':
|
|
28
|
+
case 'PASSWORD':
|
|
29
|
+
case 'SEARCH': // with [list] selector it's combobox
|
|
30
|
+
case 'TEL': // with [list] selector it's combobox
|
|
31
|
+
case 'URL': // with [list] selector it's combobox
|
|
32
|
+
default:
|
|
33
|
+
return 'textbox';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return 'textbox';
|
|
37
|
+
}
|
|
38
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForLi;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for an li tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForLi() {
|
|
11
|
+
return 'listitem';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForLink;
|
|
7
|
+
var _jsxAstUtils = require("jsx-ast-utils");
|
|
8
|
+
/**
|
|
9
|
+
* Returns the implicit role for a link tag.
|
|
10
|
+
*/
|
|
11
|
+
function getImplicitRoleForLink(attributes) {
|
|
12
|
+
if ((0, _jsxAstUtils.getProp)(attributes, 'href')) {
|
|
13
|
+
return 'link';
|
|
14
|
+
}
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForMenu;
|
|
7
|
+
var _jsxAstUtils = require("jsx-ast-utils");
|
|
8
|
+
/**
|
|
9
|
+
* Returns the implicit role for a menu tag.
|
|
10
|
+
*/
|
|
11
|
+
function getImplicitRoleForMenu(attributes) {
|
|
12
|
+
var type = (0, _jsxAstUtils.getProp)(attributes, 'type');
|
|
13
|
+
if (type) {
|
|
14
|
+
var value = (0, _jsxAstUtils.getLiteralPropValue)(type);
|
|
15
|
+
return value && value.toUpperCase() === 'TOOLBAR' ? 'toolbar' : '';
|
|
16
|
+
}
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForMenuitem;
|
|
7
|
+
var _jsxAstUtils = require("jsx-ast-utils");
|
|
8
|
+
/**
|
|
9
|
+
* Returns the implicit role for a menuitem tag.
|
|
10
|
+
*/
|
|
11
|
+
function getImplicitRoleForMenuitem(attributes) {
|
|
12
|
+
var type = (0, _jsxAstUtils.getProp)(attributes, 'type');
|
|
13
|
+
if (type) {
|
|
14
|
+
var value = (0, _jsxAstUtils.getLiteralPropValue)(type) || '';
|
|
15
|
+
switch (typeof value === 'string' && value.toUpperCase()) {
|
|
16
|
+
case 'COMMAND':
|
|
17
|
+
return 'menuitem';
|
|
18
|
+
case 'CHECKBOX':
|
|
19
|
+
return 'menuitemcheckbox';
|
|
20
|
+
case 'RADIO':
|
|
21
|
+
return 'menuitemradio';
|
|
22
|
+
default:
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return '';
|
|
27
|
+
}
|
|
28
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForMeter;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for a meter tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForMeter() {
|
|
11
|
+
return 'progressbar';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForNav;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for a nav tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForNav() {
|
|
11
|
+
return 'navigation';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForOl;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for an ol tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForOl() {
|
|
11
|
+
return 'list';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForOption;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for an option tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForOption() {
|
|
11
|
+
return 'option';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForOutput;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for an output tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForOutput() {
|
|
11
|
+
return 'status';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForProgress;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for a progress tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForProgress() {
|
|
11
|
+
return 'progressbar';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForSection;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for a section tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForSection() {
|
|
11
|
+
return 'region';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForSelect;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for a select tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForSelect() {
|
|
11
|
+
return 'listbox';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForTbody;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for a tbody tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForTbody() {
|
|
11
|
+
return 'rowgroup';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForTextarea;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for a textarea tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForTextarea() {
|
|
11
|
+
return 'textbox';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForTfoot;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for a tfoot tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForTfoot() {
|
|
11
|
+
return 'rowgroup';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForThead;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for a thead tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForThead() {
|
|
11
|
+
return 'rowgroup';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = getImplicitRoleForUl;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the implicit role for a ul tag.
|
|
9
|
+
*/
|
|
10
|
+
function getImplicitRoleForUl() {
|
|
11
|
+
return 'list';
|
|
12
|
+
}
|
|
13
|
+
module.exports = exports.default;
|