source: frontend/node_modules/eslint-plugin-jsx-a11y/lib/util/getExplicitRole.js

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: 758 bytes
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports["default"] = getExplicitRole;
7var _ariaQuery = require("aria-query");
8var _jsxAstUtils = require("jsx-ast-utils");
9/**
10 * Returns an element's computed role, which is
11 *
12 * 1. The valid value of its explicit role attribute; or
13 * 2. The implicit value of its tag.
14 */
15function getExplicitRole(tag, attributes) {
16 var explicitRole = function toLowerCase(role) {
17 if (typeof role === 'string') {
18 return role.toLowerCase();
19 }
20 return null;
21 }((0, _jsxAstUtils.getLiteralPropValue)((0, _jsxAstUtils.getProp)(attributes, 'role')));
22 if (_ariaQuery.roles.has(explicitRole)) {
23 return explicitRole;
24 }
25 return null;
26}
27module.exports = exports.default;
Note: See TracBrowser for help on using the repository browser.