|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.5 KB
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports["default"] = void 0;
|
|---|
| 7 | var _jsxAstUtils = require("jsx-ast-utils");
|
|---|
| 8 | var _schemas = require("../util/schemas");
|
|---|
| 9 | /**
|
|---|
| 10 | * @fileoverview Enforce no accesskey attribute on element.
|
|---|
| 11 | * @author Ethan Cohen
|
|---|
| 12 | */
|
|---|
| 13 |
|
|---|
| 14 | // ----------------------------------------------------------------------------
|
|---|
| 15 | // Rule Definition
|
|---|
| 16 | // ----------------------------------------------------------------------------
|
|---|
| 17 |
|
|---|
| 18 | var errorMessage = 'No access key attribute allowed. Inconsistencies between keyboard shortcuts and keyboard commands used by screen readers and keyboard-only users create a11y complications.';
|
|---|
| 19 | var schema = (0, _schemas.generateObjSchema)();
|
|---|
| 20 | var _default = exports["default"] = {
|
|---|
| 21 | meta: {
|
|---|
| 22 | docs: {
|
|---|
| 23 | url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/no-access-key.md',
|
|---|
| 24 | description: 'Enforce that the `accessKey` prop is not used on any element to avoid complications with keyboard commands used by a screen reader.'
|
|---|
| 25 | },
|
|---|
| 26 | schema: [schema]
|
|---|
| 27 | },
|
|---|
| 28 | create: function create(context) {
|
|---|
| 29 | return {
|
|---|
| 30 | JSXOpeningElement: function JSXOpeningElement(node) {
|
|---|
| 31 | var accessKey = (0, _jsxAstUtils.getProp)(node.attributes, 'accesskey');
|
|---|
| 32 | var accessKeyValue = (0, _jsxAstUtils.getPropValue)(accessKey);
|
|---|
| 33 | if (accessKey && accessKeyValue) {
|
|---|
| 34 | context.report({
|
|---|
| 35 | node,
|
|---|
| 36 | message: errorMessage
|
|---|
| 37 | });
|
|---|
| 38 | }
|
|---|
| 39 | }
|
|---|
| 40 | };
|
|---|
| 41 | }
|
|---|
| 42 | };
|
|---|
| 43 | module.exports = exports.default; |
|---|
Note:
See
TracBrowser
for help on using the repository browser.