dom-accessibility-api
Advanced tools
Comparing version 0.5.9 to 0.5.10
# dom-accessibility-api changelog | ||
## 0.5.10 | ||
### Patch Changes | ||
- [#770](https://github.com/eps1lon/dom-accessibility-api/pull/770) [`7066180`](https://github.com/eps1lon/dom-accessibility-api/commit/70661802252b4e03d1c5874c53efab010b4f2974) Thanks [@eps1lon](https://github.com/eps1lon)! - Allow computing name for inaccessible elements | ||
This is mainly targetted at integration with `@testing-library/dom`. | ||
But it can also be used as a general performance boost when used in a JSDOM environment. | ||
The rationale is that most elements are part of the a11y tree. | ||
In those cases computing a11y tree exclusion is wasted. | ||
Since it's expensive, we can disable it. | ||
The recommendation is to only ignore a11y tree inclusion locally and specifically | ||
enable it for the tests where you do know that a11y tree inclusion will play a role. | ||
## 0.5.9 | ||
@@ -4,0 +18,0 @@ |
import { ComputeTextAlternativeOptions } from "./accessible-name-and-description"; | ||
/** | ||
* implements https://w3c.github.io/accname/#mapping_additional_nd_description | ||
* @param root | ||
* @param [options] | ||
* @parma [options.getComputedStyle] - mock window.getComputedStyle. Needs `content`, `display` and `visibility` | ||
* @param options | ||
* @returns | ||
*/ | ||
export declare function computeAccessibleDescription(root: Element, options?: ComputeTextAlternativeOptions): string; | ||
//# sourceMappingURL=accessible-description.d.ts.map |
@@ -17,6 +17,5 @@ "use strict"; | ||
/** | ||
* implements https://w3c.github.io/accname/#mapping_additional_nd_description | ||
* @param root | ||
* @param [options] | ||
* @parma [options.getComputedStyle] - mock window.getComputedStyle. Needs `content`, `display` and `visibility` | ||
* @param options | ||
* @returns | ||
*/ | ||
@@ -23,0 +22,0 @@ function computeAccessibleDescription(root) { |
@@ -11,3 +11,12 @@ /** | ||
computedStyleSupportsPseudoElements?: boolean; | ||
/** | ||
* mock window.getComputedStyle. Needs `content`, `display` and `visibility` | ||
*/ | ||
getComputedStyle?: typeof window.getComputedStyle; | ||
/** | ||
* Set to `true` if you want to include hidden elements in the accessible name and description computation. | ||
* Skips 2A in https://w3c.github.io/accname/#computation-steps. | ||
* @default false | ||
*/ | ||
hidden?: boolean; | ||
} | ||
@@ -17,6 +26,6 @@ /** | ||
* @param root | ||
* @param [options] | ||
* @param [options.getComputedStyle] - mock window.getComputedStyle. Needs `content`, `display` and `visibility` | ||
* @param options | ||
* @returns | ||
*/ | ||
export declare function computeTextAlternative(root: Element, options?: ComputeTextAlternativeOptions): string; | ||
//# sourceMappingURL=accessible-name-and-description.d.ts.map |
@@ -262,4 +262,4 @@ "use strict"; | ||
* @param root | ||
* @param [options] | ||
* @param [options.getComputedStyle] - mock window.getComputedStyle. Needs `content`, `display` and `visibility` | ||
* @param options | ||
* @returns | ||
*/ | ||
@@ -277,3 +277,5 @@ | ||
_options$getComputedS = options.getComputedStyle, | ||
getComputedStyle = _options$getComputedS === void 0 ? window.getComputedStyle.bind(window) : _options$getComputedS; // 2F.i | ||
getComputedStyle = _options$getComputedS === void 0 ? window.getComputedStyle.bind(window) : _options$getComputedS, | ||
_options$hidden = options.hidden, | ||
hidden = _options$hidden === void 0 ? false : _options$hidden; // 2F.i | ||
@@ -465,3 +467,3 @@ function computeMiscTextAlternative(node, context) { | ||
if (isHidden(current, getComputedStyle) && !context.isReferenced) { | ||
if (!hidden && isHidden(current, getComputedStyle) && !context.isReferenced) { | ||
consultedNodes.add(current); | ||
@@ -468,0 +470,0 @@ return ""; |
@@ -5,6 +5,6 @@ import { ComputeTextAlternativeOptions } from "./accessible-name-and-description"; | ||
* @param root | ||
* @param [options] | ||
* @parma [options.getComputedStyle] - mock window.getComputedStyle. Needs `content`, `display` and `visibility` | ||
* @param options | ||
* @returns | ||
*/ | ||
export declare function computeAccessibleName(root: Element, options?: ComputeTextAlternativeOptions): string; | ||
//# sourceMappingURL=accessible-name.d.ts.map |
@@ -19,4 +19,4 @@ "use strict"; | ||
* @param root | ||
* @param [options] | ||
* @parma [options.getComputedStyle] - mock window.getComputedStyle. Needs `content`, `display` and `visibility` | ||
* @param options | ||
* @returns | ||
*/ | ||
@@ -23,0 +23,0 @@ |
{ | ||
"name": "dom-accessibility-api", | ||
"description": "Implements https://w3c.github.io/accname/", | ||
"version": "0.5.9", | ||
"version": "0.5.10", | ||
"main": "dist/index.js", | ||
@@ -53,4 +53,4 @@ "module": "dist/index.mjs", | ||
"@types/jest": "^27.0.0", | ||
"@typescript-eslint/eslint-plugin": "^4.25.0", | ||
"@typescript-eslint/parser": "^4.25.0", | ||
"@typescript-eslint/eslint-plugin": "^5.0.0", | ||
"@typescript-eslint/parser": "^5.0.0", | ||
"concurrently": "^6.2.0", | ||
@@ -57,0 +57,0 @@ "cross-env": "^7.0.3", |
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
262031
2090