dom-accessibility-api
Advanced tools
Comparing version 0.4.5 to 0.4.6
# dom-accessibility-api changelog | ||
## 0.4.6 | ||
### Patch Changes | ||
- [`85f0032`](https://github.com/eps1lon/dom-accessibility-api/commit/85f0032e0ec9203df7e4e5d0c3c8a206ac1968c1) [#324](https://github.com/eps1lon/dom-accessibility-api/pull/324) Thanks [@juanca](https://github.com/juanca)! - Consider `<title>` for the name of its `<svg>` element. | ||
* [`f7c1981`](https://github.com/eps1lon/dom-accessibility-api/commit/f7c19812307e8847dbe1b678a3bafdc6dbf7f23b) [#288](https://github.com/eps1lon/dom-accessibility-api/pull/288) Thanks [@eps1lon](https://github.com/eps1lon)! - Drop node 13 support | ||
We only stopped testing. Probability of breakage should be very low. | ||
**New policy**: | ||
> Only [active node versions](https://nodejs.org/en/about/releases/) are supported. | ||
> Inactive node versions can stop working in a SemVer MINOR release. | ||
- [`fa53c51`](https://github.com/eps1lon/dom-accessibility-api/commit/fa53c510d8aab6cf3561c91949f1df3a52a500a8) [#210](https://github.com/eps1lon/dom-accessibility-api/pull/210) Thanks [@eps1lon](https://github.com/eps1lon)! - Implement accessbile description computation | ||
```ts | ||
import { computeAccessibleDescription } from "dom-accessibility-api"; | ||
const description = computeAccessibleDescription(element); | ||
``` | ||
Warning: It always considers `title` attributes if the description is empty. | ||
Even if the `title` attribute was already used for the accessible name. | ||
This is fails a web-platform-test. | ||
The other failing test is due to `aria-label` being ignored for the description which is correct by spec. | ||
It's likely an issue with wpt. | ||
The other tests are passing (13/15). | ||
## 0.4.5 | ||
@@ -4,0 +34,0 @@ |
@@ -0,9 +1,4 @@ | ||
import { ComputeTextAlternativeOptions } from "./accessible-name-and-description"; | ||
/** | ||
* interface for an options-bag where `window.getComputedStyle` can be mocked | ||
*/ | ||
interface GetComputedStyleOptions { | ||
getComputedStyle?: typeof window.getComputedStyle; | ||
} | ||
/** | ||
* implements https://w3c.github.io/accname/#mapping_additional_nd_te | ||
* implements https://w3c.github.io/accname/#mapping_additional_nd_name | ||
* @param root | ||
@@ -13,4 +8,3 @@ * @param [options] | ||
*/ | ||
export declare function computeAccessibleName(root: Element, options?: GetComputedStyleOptions): string; | ||
export {}; | ||
export declare function computeAccessibleName(root: Element, options?: ComputeTextAlternativeOptions): string; | ||
//# sourceMappingURL=accessible-name.d.ts.map |
@@ -6,212 +6,14 @@ "use strict"; | ||
var _array = _interopRequireDefault(require("./polyfills/array.from")); | ||
var _accessibleNameAndDescription = require("./accessible-name-and-description"); | ||
var _SetLike = _interopRequireDefault(require("./polyfills/SetLike")); | ||
var _getRole = _interopRequireDefault(require("./getRole")); | ||
var _util = require("./util"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
* implements https://w3c.github.io/accname/ | ||
*/ | ||
/** | ||
* Small utility that handles all the JS quirks with `this` which is important | ||
* if no mock is provided. | ||
* @param element | ||
* @param options - These are not optional to prevent accidentally calling it without options in `computeAccessibleName` | ||
*/ | ||
function createGetComputedStyle(element, options) { | ||
var window = (0, _util.safeWindow)(element); | ||
var _options$getComputedS = options.getComputedStyle, | ||
getComputedStyle = _options$getComputedS === void 0 ? window.getComputedStyle.bind(window) : _options$getComputedS; | ||
return getComputedStyle; | ||
} | ||
/** | ||
* | ||
* @param {string} string - | ||
* @returns {FlatString} - | ||
*/ | ||
function asFlatString(s) { | ||
return s.trim().replace(/\s\s+/g, " "); | ||
} | ||
/** | ||
* https://w3c.github.io/aria/#namefromprohibited | ||
*/ | ||
function prohibitsNaming(node) { | ||
return hasAnyConcreteRoles(node, ["caption", "code", "deletion", "emphasis", "generic", "insertion", "paragraph", "presentation", "strong", "subscript", "superscript"]); | ||
return (0, _util.hasAnyConcreteRoles)(node, ["caption", "code", "deletion", "emphasis", "generic", "insertion", "paragraph", "presentation", "strong", "subscript", "superscript"]); | ||
} | ||
/** | ||
* | ||
* @param node - | ||
* @param options - These are not optional to prevent accidentally calling it without options in `computeAccessibleName` | ||
* @returns {boolean} - | ||
*/ | ||
function isHidden(node, options) { | ||
if (!(0, _util.isElement)(node)) { | ||
return false; | ||
} | ||
if (node.hasAttribute("hidden") || node.getAttribute("aria-hidden") === "true") { | ||
return true; | ||
} | ||
var style = createGetComputedStyle(node, options)(node); | ||
return style.getPropertyValue("display") === "none" || style.getPropertyValue("visibility") === "hidden"; | ||
} | ||
/** | ||
* | ||
* @param {Node} node - | ||
* @param {string} attributeName - | ||
* @returns {Element[]} - | ||
*/ | ||
function idRefs(node, attributeName) { | ||
if ((0, _util.isElement)(node) && node.hasAttribute(attributeName)) { | ||
// safe due to hasAttribute check | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
var ids = node.getAttribute(attributeName).split(" "); | ||
return ids // safe since it can't be null for an Element | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
.map(function (id) { | ||
return node.ownerDocument.getElementById(id); | ||
}).filter(function (element) { | ||
return element !== null; | ||
} // TODO: why does this not narrow? | ||
); | ||
} | ||
return []; | ||
} | ||
/** | ||
* @param {Node} node - | ||
* @returns {boolean} - As defined in step 2E of https://w3c.github.io/accname/#mapping_additional_nd_te | ||
*/ | ||
function isControl(node) { | ||
return hasAnyConcreteRoles(node, ["button", "combobox", "listbox", "textbox"]) || hasAbstractRole(node, "range"); | ||
} | ||
function hasAbstractRole(node, role) { | ||
if (!(0, _util.isElement)(node)) { | ||
return false; | ||
} | ||
switch (role) { | ||
case "range": | ||
return hasAnyConcreteRoles(node, ["meter", "progressbar", "scrollbar", "slider", "spinbutton"]); | ||
default: | ||
throw new TypeError("No knowledge about abstract role '".concat(role, "'. This is likely a bug :(")); | ||
} | ||
} | ||
function hasAnyConcreteRoles(node, roles) { | ||
if ((0, _util.isElement)(node)) { | ||
return roles.indexOf((0, _getRole.default)(node)) !== -1; | ||
} | ||
return false; | ||
} | ||
/** | ||
* element.querySelectorAll but also considers owned tree | ||
* @param element | ||
* @param selectors | ||
*/ | ||
function querySelectorAllSubtree(element, selectors) { | ||
var elements = (0, _array.default)(element.querySelectorAll(selectors)); | ||
idRefs(element, "aria-owns").forEach(function (root) { | ||
// babel transpiles this assuming an iterator | ||
elements.push.apply(elements, (0, _array.default)(root.querySelectorAll(selectors))); | ||
}); | ||
return elements; | ||
} | ||
function querySelectedOptions(listbox) { | ||
if ((0, _util.isHTMLSelectElement)(listbox)) { | ||
// IE11 polyfill | ||
return listbox.selectedOptions || querySelectorAllSubtree(listbox, "[selected]"); | ||
} | ||
return querySelectorAllSubtree(listbox, '[aria-selected="true"]'); | ||
} | ||
function isMarkedPresentational(node) { | ||
return hasAnyConcreteRoles(node, ["none", "presentation"]); | ||
} | ||
/** | ||
* Elements specifically listed in html-aam | ||
* | ||
* We don't need this for `label` or `legend` elements. | ||
* Their implicit roles already allow "naming from content". | ||
* | ||
* sources: | ||
* | ||
* - https://w3c.github.io/html-aam/#table-element | ||
*/ | ||
function isNativeHostLanguageTextAlternativeElement(node) { | ||
return (0, _util.isHTMLTableCaptionElement)(node); | ||
} | ||
/** | ||
* https://w3c.github.io/aria/#namefromcontent | ||
*/ | ||
function allowsNameFromContent(node) { | ||
return hasAnyConcreteRoles(node, ["button", "cell", "checkbox", "columnheader", "gridcell", "heading", "label", "legend", "link", "menuitem", "menuitemcheckbox", "menuitemradio", "option", "radio", "row", "rowheader", "switch", "tab", "tooltip", "treeitem"]); | ||
} | ||
/** | ||
* TODO https://github.com/eps1lon/dom-accessibility-api/issues/100 | ||
*/ | ||
function isDescendantOfNativeHostLanguageTextAlternativeElement( // eslint-disable-next-line @typescript-eslint/no-unused-vars -- not implemented yet | ||
node) { | ||
return false; | ||
} | ||
/** | ||
* TODO https://github.com/eps1lon/dom-accessibility-api/issues/101 | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- not implemented yet | ||
function computeTooltipAttributeValue(node) { | ||
return null; | ||
} | ||
function getValueOfTextbox(element) { | ||
if ((0, _util.isHTMLInputElement)(element) || (0, _util.isHTMLTextAreaElement)(element)) { | ||
return element.value; | ||
} // https://github.com/eps1lon/dom-accessibility-api/issues/4 | ||
return element.textContent || ""; | ||
} | ||
function getTextualContent(declaration) { | ||
var content = declaration.getPropertyValue("content"); | ||
if (/^["'].*["']$/.test(content)) { | ||
return content.slice(1, -1); | ||
} | ||
return ""; | ||
} | ||
/** | ||
* implements https://w3c.github.io/accname/#mapping_additional_nd_te | ||
* implements https://w3c.github.io/accname/#mapping_additional_nd_name | ||
* @param root | ||
@@ -225,296 +27,9 @@ * @param [options] | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var consultedNodes = new _SetLike.default(); | ||
if (prohibitsNaming(root)) { | ||
return ""; | ||
} // 2F.i | ||
function computeMiscTextAlternative(node, context) { | ||
var accumulatedText = ""; | ||
if ((0, _util.isElement)(node)) { | ||
var pseudoBefore = createGetComputedStyle(node, options)(node, "::before"); | ||
var beforeContent = getTextualContent(pseudoBefore); | ||
accumulatedText = "".concat(beforeContent, " ").concat(accumulatedText); | ||
} // FIXME: This is not defined in the spec | ||
// But it is required in the web-platform-test | ||
var childNodes = (0, _array.default)(node.childNodes).concat(idRefs(node, "aria-owns")); | ||
childNodes.forEach(function (child) { | ||
var result = computeTextAlternative(child, { | ||
isEmbeddedInLabel: context.isEmbeddedInLabel, | ||
isReferenced: false, | ||
recursion: true | ||
}); // TODO: Unclear why display affects delimiter | ||
// see https://github.com/w3c/accname/issues/3 | ||
var display = (0, _util.isElement)(child) ? createGetComputedStyle(child, options // eslint-disable-next-line no-mixed-spaces-and-tabs -- prettier bug? | ||
)(child).getPropertyValue("display") : "inline"; | ||
var separator = display !== "inline" ? " " : ""; // trailing separator for wpt tests | ||
accumulatedText += "".concat(separator).concat(result).concat(separator); | ||
}); | ||
if ((0, _util.isElement)(node)) { | ||
var pseudoAfter = createGetComputedStyle(node, options)(node, ":after"); | ||
var afterContent = getTextualContent(pseudoAfter); | ||
accumulatedText = "".concat(accumulatedText, " ").concat(afterContent); | ||
} | ||
return accumulatedText; | ||
} | ||
function computeAttributeTextAlternative(node) { | ||
if (!(0, _util.isElement)(node)) { | ||
return null; | ||
} | ||
var titleAttribute = node.getAttributeNode("title"); | ||
if (titleAttribute !== null && !consultedNodes.has(titleAttribute)) { | ||
consultedNodes.add(titleAttribute); | ||
return titleAttribute.value; | ||
} | ||
var altAttribute = node.getAttributeNode("alt"); | ||
if (altAttribute !== null && !consultedNodes.has(altAttribute)) { | ||
consultedNodes.add(altAttribute); | ||
return altAttribute.value; | ||
} | ||
if ((0, _util.isHTMLInputElement)(node) && node.type === "button") { | ||
consultedNodes.add(node); | ||
return node.getAttribute("value") || ""; | ||
} | ||
return null; | ||
} | ||
function computeElementTextAlternative(node) { | ||
// https://w3c.github.io/html-aam/#fieldset-and-legend-elements | ||
if ((0, _util.isHTMLFieldSetElement)(node)) { | ||
consultedNodes.add(node); | ||
var children = (0, _array.default)(node.childNodes); | ||
for (var i = 0; i < children.length; i += 1) { | ||
var child = children[i]; | ||
if ((0, _util.isHTMLLegendElement)(child)) { | ||
return computeTextAlternative(child, { | ||
isEmbeddedInLabel: false, | ||
isReferenced: false, | ||
recursion: false | ||
}); | ||
} | ||
} | ||
return null; | ||
} // https://w3c.github.io/html-aam/#table-element | ||
if ((0, _util.isHTMLTableElement)(node)) { | ||
consultedNodes.add(node); | ||
var _children = (0, _array.default)(node.childNodes); | ||
for (var _i = 0; _i < _children.length; _i += 1) { | ||
var _child = _children[_i]; | ||
if ((0, _util.isHTMLTableCaptionElement)(_child)) { | ||
return computeTextAlternative(_child, { | ||
isEmbeddedInLabel: false, | ||
isReferenced: false, | ||
recursion: false | ||
}); | ||
} | ||
} | ||
return null; | ||
} | ||
if (!((0, _util.isHTMLInputElement)(node) || (0, _util.isHTMLSelectElement)(node) || (0, _util.isHTMLTextAreaElement)(node))) { | ||
return null; | ||
} | ||
var input = node; // https://w3c.github.io/html-aam/#input-type-text-input-type-password-input-type-search-input-type-tel-input-type-email-input-type-url-and-textarea-element-accessible-description-computation | ||
if (input.type === "submit") { | ||
return "Submit"; | ||
} | ||
if (input.type === "reset") { | ||
return "Reset"; | ||
} | ||
var labels = input.labels; // IE11 does not implement labels, TODO: verify with caniuse instead of mdn | ||
if (labels === null || labels === undefined || labels.length === 0) { | ||
return null; | ||
} | ||
consultedNodes.add(input); | ||
return (0, _array.default)(labels).map(function (element) { | ||
return computeTextAlternative(element, { | ||
isEmbeddedInLabel: true, | ||
isReferenced: false, | ||
recursion: true | ||
}); | ||
}).filter(function (label) { | ||
return label.length > 0; | ||
}).join(" "); | ||
} | ||
function computeTextAlternative(current, context) { | ||
if (consultedNodes.has(current)) { | ||
return ""; | ||
} // special casing, cheating to make tests pass | ||
// https://github.com/w3c/accname/issues/67 | ||
if (hasAnyConcreteRoles(current, ["menu"])) { | ||
consultedNodes.add(current); | ||
return ""; | ||
} // 2A | ||
if (isHidden(current, options) && !context.isReferenced) { | ||
consultedNodes.add(current); | ||
return ""; | ||
} // 2B | ||
var labelElements = idRefs(current, "aria-labelledby"); | ||
if (!context.isReferenced && labelElements.length > 0) { | ||
return labelElements.map(function (element) { | ||
return computeTextAlternative(element, { | ||
isEmbeddedInLabel: context.isEmbeddedInLabel, | ||
isReferenced: true, | ||
// thais isn't recursion as specified, otherwise we would skip | ||
// `aria-label` in | ||
// <input id="myself" aria-label="foo" aria-labelledby="myself" | ||
recursion: false | ||
}); | ||
}).join(" "); | ||
} // 2C | ||
// Changed from the spec in anticipation of https://github.com/w3c/accname/issues/64 | ||
// spec says we should only consider skipping if we have a non-empty label | ||
var skipToStep2E = context.recursion && isControl(current); | ||
if (!skipToStep2E) { | ||
var ariaLabel = ((0, _util.isElement)(current) && current.getAttribute("aria-label") || "").trim(); | ||
if (ariaLabel !== "") { | ||
consultedNodes.add(current); | ||
return ariaLabel; | ||
} // 2D | ||
if (!isMarkedPresentational(current)) { | ||
var elementTextAlternative = computeElementTextAlternative(current); | ||
if (elementTextAlternative !== null) { | ||
consultedNodes.add(current); | ||
return elementTextAlternative; | ||
} | ||
var attributeTextAlternative = computeAttributeTextAlternative(current); | ||
if (attributeTextAlternative !== null) { | ||
consultedNodes.add(current); | ||
return attributeTextAlternative; | ||
} | ||
} | ||
} // 2E | ||
if (skipToStep2E || context.isEmbeddedInLabel || context.isReferenced) { | ||
if (hasAnyConcreteRoles(current, ["combobox", "listbox"])) { | ||
consultedNodes.add(current); | ||
var selectedOptions = querySelectedOptions(current); | ||
if (selectedOptions.length === 0) { | ||
// defined per test `name_heading_combobox` | ||
return (0, _util.isHTMLInputElement)(current) ? current.value : ""; | ||
} | ||
return (0, _array.default)(selectedOptions).map(function (selectedOption) { | ||
return computeTextAlternative(selectedOption, { | ||
isEmbeddedInLabel: context.isEmbeddedInLabel, | ||
isReferenced: false, | ||
recursion: true | ||
}); | ||
}).join(" "); | ||
} | ||
if (hasAbstractRole(current, "range")) { | ||
consultedNodes.add(current); | ||
if (current.hasAttribute("aria-valuetext")) { | ||
// safe due to hasAttribute guard | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
return current.getAttribute("aria-valuetext"); | ||
} | ||
if (current.hasAttribute("aria-valuenow")) { | ||
// safe due to hasAttribute guard | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
return current.getAttribute("aria-valuenow"); | ||
} // Otherwise, use the value as specified by a host language attribute. | ||
return current.getAttribute("value") || ""; | ||
} | ||
if (hasAnyConcreteRoles(current, ["textbox"])) { | ||
consultedNodes.add(current); | ||
return getValueOfTextbox(current); | ||
} | ||
} // 2F: https://w3c.github.io/accname/#step2F | ||
if (allowsNameFromContent(current) || (0, _util.isElement)(current) && context.isReferenced || isNativeHostLanguageTextAlternativeElement(current) || isDescendantOfNativeHostLanguageTextAlternativeElement(current)) { | ||
consultedNodes.add(current); | ||
return computeMiscTextAlternative(current, { | ||
isEmbeddedInLabel: context.isEmbeddedInLabel, | ||
isReferenced: false | ||
}); | ||
} | ||
if (current.nodeType === current.TEXT_NODE) { | ||
consultedNodes.add(current); | ||
return current.textContent || ""; | ||
} | ||
if (context.recursion) { | ||
consultedNodes.add(current); | ||
return computeMiscTextAlternative(current, { | ||
isEmbeddedInLabel: context.isEmbeddedInLabel, | ||
isReferenced: false | ||
}); | ||
} | ||
var tooltipAttributeValue = computeTooltipAttributeValue(current); | ||
if (tooltipAttributeValue !== null) { | ||
consultedNodes.add(current); | ||
return tooltipAttributeValue; | ||
} // TODO should this be reachable? | ||
consultedNodes.add(current); | ||
return ""; | ||
} | ||
return asFlatString(computeTextAlternative(root, { | ||
isEmbeddedInLabel: false, | ||
isReferenced: false, | ||
recursion: false | ||
})); | ||
return (0, _accessibleNameAndDescription.computeTextAlternative)(root, options); | ||
} | ||
//# sourceMappingURL=accessible-name.js.map |
@@ -157,4 +157,3 @@ "use strict"; | ||
if (element.hasAttribute("role")) { | ||
// safe due to hasAttribute check | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- safe due to hasAttribute check | ||
var _trim$split = element.getAttribute("role").trim().split(" "), | ||
@@ -161,0 +160,0 @@ _trim$split2 = _slicedToArray(_trim$split, 1), |
@@ -0,3 +1,4 @@ | ||
export { computeAccessibleDescription } from "./accessible-description"; | ||
export { computeAccessibleName } from "./accessible-name"; | ||
export { default as getRole } from "./getRole"; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
exports.__esModule = true; | ||
exports.getRole = exports.computeAccessibleName = void 0; | ||
exports.getRole = exports.computeAccessibleName = exports.computeAccessibleDescription = void 0; | ||
var _accessibleDescription = require("./accessible-description"); | ||
exports.computeAccessibleDescription = _accessibleDescription.computeAccessibleDescription; | ||
var _accessibleName = require("./accessible-name"); | ||
@@ -7,0 +11,0 @@ |
@@ -10,2 +10,13 @@ export declare function isElement(node: Node | null): node is Element; | ||
export declare function isHTMLLegendElement(node: Node | null): node is HTMLLegendElement; | ||
export declare function isSVGElement(node: Node | null): node is SVGElement; | ||
export declare function isSVGSVGElement(node: Node | null): node is SVGSVGElement; | ||
export declare function isSVGTitleElement(node: Node | null): node is SVGTitleElement; | ||
/** | ||
* | ||
* @param {Node} node - | ||
* @param {string} attributeName - | ||
* @returns {Element[]} - | ||
*/ | ||
export declare function queryIdRefs(node: Node, attributeName: string): Element[]; | ||
export declare function hasAnyConcreteRoles(node: Node, roles: Array<string | null>): node is Element; | ||
//# sourceMappingURL=util.d.ts.map |
@@ -13,3 +13,12 @@ "use strict"; | ||
exports.isHTMLLegendElement = isHTMLLegendElement; | ||
exports.isSVGElement = isSVGElement; | ||
exports.isSVGSVGElement = isSVGSVGElement; | ||
exports.isSVGTitleElement = isSVGTitleElement; | ||
exports.queryIdRefs = queryIdRefs; | ||
exports.hasAnyConcreteRoles = hasAnyConcreteRoles; | ||
var _getRole = _interopRequireDefault(require("./getRole")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function isElement(node) { | ||
@@ -57,2 +66,44 @@ return node !== null && node.nodeType === node.ELEMENT_NODE; | ||
} | ||
function isSVGElement(node) { | ||
return isElement(node) && node.ownerSVGElement !== undefined; | ||
} | ||
function isSVGSVGElement(node) { | ||
return isElement(node) && node.tagName === "svg"; | ||
} | ||
function isSVGTitleElement(node) { | ||
return isSVGElement(node) && node.tagName === "title"; | ||
} | ||
/** | ||
* | ||
* @param {Node} node - | ||
* @param {string} attributeName - | ||
* @returns {Element[]} - | ||
*/ | ||
function queryIdRefs(node, attributeName) { | ||
if (isElement(node) && node.hasAttribute(attributeName)) { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- safe due to hasAttribute check | ||
var ids = node.getAttribute(attributeName).split(" "); | ||
return ids.map(function (id) { | ||
return node.ownerDocument.getElementById(id); | ||
}).filter(function (element) { | ||
return element !== null; | ||
} // TODO: why does this not narrow? | ||
); | ||
} | ||
return []; | ||
} | ||
function hasAnyConcreteRoles(node, roles) { | ||
if (isElement(node)) { | ||
return roles.indexOf((0, _getRole.default)(node)) !== -1; | ||
} | ||
return false; | ||
} | ||
//# sourceMappingURL=util.js.map |
{ | ||
"name": "dom-accessibility-api", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"main": "dist/index.js", | ||
@@ -43,25 +43,25 @@ "module": "dist/index.mjs", | ||
"devDependencies": { | ||
"@babel/cli": "^7.10.1", | ||
"@babel/core": "^7.10.2", | ||
"@babel/plugin-proposal-class-properties": "^7.10.1", | ||
"@babel/preset-env": "^7.10.2", | ||
"@babel/preset-typescript": "^7.10.1", | ||
"@babel/cli": "^7.10.4", | ||
"@babel/core": "^7.10.4", | ||
"@babel/plugin-proposal-class-properties": "^7.10.4", | ||
"@babel/preset-env": "^7.10.4", | ||
"@babel/preset-typescript": "^7.10.4", | ||
"@changesets/changelog-github": "^0.2.6", | ||
"@changesets/cli": "^2.8.0", | ||
"@testing-library/dom": "^7.7.3", | ||
"@types/jest": "^25.2.3", | ||
"@typescript-eslint/eslint-plugin": "^3.1.0", | ||
"@typescript-eslint/parser": "^3.1.0", | ||
"@changesets/cli": "^2.9.2", | ||
"@testing-library/dom": "^7.20.1", | ||
"@types/jest": "^26.0.4", | ||
"@typescript-eslint/eslint-plugin": "^3.6.0", | ||
"@typescript-eslint/parser": "^3.6.0", | ||
"concurrently": "^5.2.0", | ||
"cross-env": "^7.0.2", | ||
"cypress": "^4.7.0", | ||
"eslint": "^7.1.0", | ||
"eslint-plugin-jest": "^23.13.2", | ||
"jest": "^26.0.1", | ||
"jest-diff": "^26.0.1", | ||
"jest-junit": "^10.0.0", | ||
"cypress": "^4.10.0", | ||
"eslint": "^7.4.0", | ||
"eslint-plugin-jest": "^23.18.0", | ||
"jest": "^26.1.0", | ||
"jest-diff": "^26.1.0", | ||
"jest-junit": "^11.0.1", | ||
"js-yaml": "^3.14.0", | ||
"jsdom": "^16.2.2", | ||
"jsdom": "^16.3.0", | ||
"minimatch": "^3.0.4", | ||
"mocha": "^7.2.0", | ||
"mocha": "^8.0.1", | ||
"mocha-sugar-free": "^1.4.0", | ||
@@ -73,4 +73,4 @@ "prettier": "^2.0.5", | ||
"rimraf": "^3.0.2", | ||
"serve": "^11.3.1", | ||
"typescript": "^3.9.3" | ||
"serve": "^11.3.2", | ||
"typescript": "^3.9.6" | ||
}, | ||
@@ -77,0 +77,0 @@ "resolutions": { |
# dom-accessibility-api | ||
[![npm version](https://badge.fury.io/js/dom-accessibility-api.svg)](https://badge.fury.io/js/dom-accessibility-api) | ||
[![Build Status](https://dev.azure.com/silbermannsebastian/dom-accessibility-api/_apis/build/status/eps1lon.dom-accessibility-api?branchName=master)](https://dev.azure.com/silbermannsebastian/dom-accessibility-api/_build/latest?definitionId=6&branchName=master) | ||
[![Build Status](https://dev.azure.com/silbermannsebastian/dom-accessibility-api/_apis/build/status/eps1lon.dom-accessibility-api?branchName=main)](https://dev.azure.com/silbermannsebastian/dom-accessibility-api/_build/latest?definitionId=6&branchName=main) | ||
![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/silbermannsebastian/dom-accessibility-api/6) | ||
Computes the accessible name of a given DOM Element. | ||
Computes the accessible name or description of a given DOM Element. | ||
https://w3c.github.io/accname/ implemented in JavaScript for testing. | ||
@@ -15,3 +15,6 @@ | ||
```js | ||
import { computeAccessibleName } from "dom-accessibility-api"; | ||
import { | ||
computeAccessibleName, | ||
computeAccessibleDescription, | ||
} from "dom-accessibility-api"; | ||
``` | ||
@@ -24,2 +27,5 @@ | ||
WARNING: Only [active node versions](https://nodejs.org/en/about/releases/) are supported. | ||
Inactive node versions can stop working in a SemVer MINOR release. | ||
```bash | ||
@@ -43,3 +49,3 @@ ie 11 | ||
140/144 | ||
153/159 | ||
@@ -49,3 +55,3 @@ ### jsdom | ||
<details> | ||
<summary>report 124/159 passing of which 16 are due `::before { content }`, 15 are accessible desc, 4 are pathological </summary> | ||
<summary>report 138/159 passing of which 15 are due `::before { content }`, one might a wrong test, 5 are pathological </summary> | ||
@@ -57,14 +63,14 @@ ```bash | ||
✓ [expected fail] description_from_content_of_describedby_element-manual.html | ||
✓ [expected fail] description_link-with-label-manual.html | ||
✓ [expected fail] description_test_case_557-manual.html | ||
✓ [expected fail] description_test_case_664-manual.html | ||
✓ [expected fail] description_test_case_665-manual.html | ||
✓ [expected fail] description_test_case_666-manual.html | ||
✓ [expected fail] description_test_case_772-manual.html | ||
✓ [expected fail] description_test_case_773-manual.html | ||
✓ [expected fail] description_test_case_774-manual.html | ||
✓ [expected fail] description_test_case_838-manual.html | ||
✓ [expected fail] description_test_case_broken_reference-manual.html | ||
✓ [expected fail] description_test_case_one_valid_reference-manual.html | ||
✓ [expected fail] description_title-same-element-manual.html | ||
✓ description_link-with-label-manual.html | ||
✓ description_test_case_557-manual.html | ||
✓ description_test_case_664-manual.html | ||
✓ description_test_case_665-manual.html | ||
✓ description_test_case_666-manual.html | ||
✓ description_test_case_772-manual.html | ||
✓ description_test_case_773-manual.html | ||
✓ description_test_case_774-manual.html | ||
✓ description_test_case_838-manual.html | ||
✓ description_test_case_broken_reference-manual.html | ||
✓ description_test_case_one_valid_reference-manual.html | ||
✓ description_title-same-element-manual.html | ||
✓ name_1.0_combobox-focusable-alternative-manual.html | ||
@@ -71,0 +77,0 @@ ✓ name_1.0_combobox-focusable-manual.html |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
205776
56
1652
223
1