2019-04-10 21:36:00 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constants used in various panels, shared between client and the server.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Accessibility Panel ====================================================== */
|
|
|
|
|
2019-06-06 11:05:19 +03:00
|
|
|
// List of audit types.
|
|
|
|
const AUDIT_TYPE = {
|
|
|
|
CONTRAST: "CONTRAST",
|
2019-08-28 16:09:24 +03:00
|
|
|
KEYBOARD: "KEYBOARD",
|
2019-06-06 11:05:19 +03:00
|
|
|
TEXT_LABEL: "TEXT_LABEL",
|
|
|
|
};
|
|
|
|
|
|
|
|
// Types of issues grouped by audit types.
|
|
|
|
const ISSUE_TYPE = {
|
2019-08-28 16:09:24 +03:00
|
|
|
[AUDIT_TYPE.KEYBOARD]: {
|
|
|
|
// Focusable accessible objects have no semantics.
|
|
|
|
FOCUSABLE_NO_SEMANTICS: "FOCUSABLE_NO_SEMANTICS",
|
|
|
|
// Tab index greater than 0 is provided.
|
|
|
|
FOCUSABLE_POSITIVE_TABINDEX: "FOCUSABLE_POSITIVE_TABINDEX",
|
|
|
|
// Interactive accesible objects do not have an associated action.
|
|
|
|
INTERACTIVE_NO_ACTION: "INTERACTIVE_NO_ACTION",
|
|
|
|
// Interative accessible objcets are not focusable.
|
|
|
|
INTERACTIVE_NOT_FOCUSABLE: "INTERACTIVE_NOT_FOCUSABLE",
|
2019-09-02 09:59:33 +03:00
|
|
|
// Accessible objects can only be interacted with a mouse.
|
|
|
|
MOUSE_INTERACTIVE_ONLY: "MOUSE_INTERACTIVE_ONLY",
|
2019-08-28 16:09:24 +03:00
|
|
|
// Focusable accessible objects have no focus styling.
|
|
|
|
NO_FOCUS_VISIBLE: "NO_FOCUS_VISIBLE",
|
|
|
|
},
|
2019-06-06 11:05:19 +03:00
|
|
|
[AUDIT_TYPE.TEXT_LABEL]: {
|
|
|
|
// <AREA> name is provided via "alt" attribute.
|
|
|
|
AREA_NO_NAME_FROM_ALT: "AREA_NO_NAME_FROM_ALT",
|
|
|
|
// Dialog name is not provided.
|
|
|
|
DIALOG_NO_NAME: "DIALOG_NO_NAME",
|
|
|
|
// Document title is not provided.
|
|
|
|
DOCUMENT_NO_TITLE: "DOCUMENT_NO_TITLE",
|
|
|
|
// <EMBED> name is not provided.
|
|
|
|
EMBED_NO_NAME: "EMBED_NO_NAME",
|
|
|
|
// <FIGURE> name is not provided.
|
|
|
|
FIGURE_NO_NAME: "FIGURE_NO_NAME",
|
|
|
|
// <FIELDSET> name is not provided.
|
|
|
|
FORM_FIELDSET_NO_NAME: "FORM_FIELDSET_NO_NAME",
|
|
|
|
// <FIELDSET> name is not provided via <LEGEND> element.
|
|
|
|
FORM_FIELDSET_NO_NAME_FROM_LEGEND: "FORM_FIELDSET_NO_NAME_FROM_LEGEND",
|
|
|
|
// Form element's name is not provided.
|
|
|
|
FORM_NO_NAME: "FORM_NO_NAME",
|
|
|
|
// Form element's name is not visible.
|
|
|
|
FORM_NO_VISIBLE_NAME: "FORM_NO_VISIBLE_NAME",
|
|
|
|
// <OPTGROUP> name is not provided via "label" attribute.
|
|
|
|
FORM_OPTGROUP_NO_NAME_FROM_LABEL: "FORM_OPTGROUP_NO_NAME_FROM_LABEL",
|
|
|
|
// <FRAME> name is not provided.
|
|
|
|
FRAME_NO_NAME: "FRAME_NO_NAME",
|
|
|
|
// <H{1, 2, ...}> has no content.
|
|
|
|
HEADING_NO_CONTENT: "HEADING_NO_CONTENT",
|
|
|
|
// <H{1, 2, ...}> name is not provided.
|
|
|
|
HEADING_NO_NAME: "HEADING_NO_NAME",
|
|
|
|
// <IFRAME> name is not provided via "title" attribute.
|
|
|
|
IFRAME_NO_NAME_FROM_TITLE: "IFRAME_NO_NAME_FROM_TITLE",
|
|
|
|
// <IMG> name is not provided (including empty name).
|
|
|
|
IMAGE_NO_NAME: "IMAGE_NO_NAME",
|
|
|
|
// Interactive element's name is not provided.
|
|
|
|
INTERACTIVE_NO_NAME: "INTERACTIVE_NO_NAME",
|
|
|
|
// <MGLYPH> name is no provided.
|
|
|
|
MATHML_GLYPH_NO_NAME: "MATHML_GLYPH_NO_NAME",
|
|
|
|
// Toolbar's name is not provided when more than one toolbar is present.
|
|
|
|
TOOLBAR_NO_NAME: "TOOLBAR_NO_NAME",
|
2019-04-16 17:53:07 +03:00
|
|
|
},
|
2019-04-10 21:36:00 +03:00
|
|
|
};
|
2019-06-06 11:05:19 +03:00
|
|
|
|
|
|
|
// Constants associated with WCAG guidelines score system.
|
|
|
|
const SCORES = {
|
|
|
|
// Satisfies WCAG AA guidelines.
|
|
|
|
AA: "AA",
|
|
|
|
// Satisfies WCAG AAA guidelines.
|
|
|
|
AAA: "AAA",
|
|
|
|
// Elevates accessibility experience.
|
|
|
|
BEST_PRACTICES: "BEST_PRACTICES",
|
|
|
|
// Does not satisfy the baseline WCAG guidelines.
|
2019-08-28 16:09:23 +03:00
|
|
|
FAIL: "FAIL",
|
2019-06-06 11:05:19 +03:00
|
|
|
// Partially satisfies the WCAG AA guidelines.
|
|
|
|
WARNING: "WARNING",
|
|
|
|
};
|
|
|
|
|
2019-08-29 07:55:45 +03:00
|
|
|
// List of simulation types.
|
|
|
|
const SIMULATION_TYPE = {
|
|
|
|
// Low red color blindness
|
|
|
|
PROTANOMALY: "PROTANOMALY",
|
|
|
|
// Low green color blindness
|
|
|
|
DEUTERANOMALY: "DEUTERANOMALY",
|
|
|
|
// Low blue color blindness
|
|
|
|
TRITANOMALY: "TRITANOMALY",
|
|
|
|
// No red color blindness
|
|
|
|
PROTANOPIA: "PROTANOPIA",
|
|
|
|
// No green color blindness
|
|
|
|
DEUTERANOPIA: "DEUTERANOPIA",
|
|
|
|
// No blue color blindness
|
|
|
|
TRITANOPIA: "TRITANOPIA",
|
|
|
|
// Low contrast
|
|
|
|
CONTRAST_LOSS: "CONTRAST_LOSS",
|
|
|
|
};
|
|
|
|
|
2020-07-20 11:15:03 +03:00
|
|
|
/* WebConsole Panel ====================================================== */
|
|
|
|
|
|
|
|
const MESSAGE_CATEGORY = {
|
|
|
|
CSS_PARSER: "CSS Parser",
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
accessibility: {
|
|
|
|
AUDIT_TYPE,
|
|
|
|
ISSUE_TYPE,
|
|
|
|
SCORES,
|
|
|
|
SIMULATION_TYPE,
|
|
|
|
},
|
|
|
|
MESSAGE_CATEGORY,
|
2019-06-06 11:05:19 +03:00
|
|
|
};
|