source: frontend/node_modules/eslint-plugin-jsx-a11y/lib/util/implicitRoles/input.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: 1.0 KB
RevLine 
[9af201e]1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports["default"] = getImplicitRoleForInput;
7var _jsxAstUtils = require("jsx-ast-utils");
8/**
9 * Returns the implicit role for an input tag.
10 */
11function 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}
38module.exports = exports.default;
Note: See TracBrowser for help on using the repository browser.