# 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
### Patch Changes
- [#762](https://github.com/eps1lon/dom-accessibility-api/pull/762) [`b3e4a17`](https://github.com/eps1lon/dom-accessibility-api/commit/b3e4a1711cd0d8dbc83bd6c656698cc2b2cc3b6a) Thanks [@eps1lon](https://github.com/eps1lon)! - Compute name from author for `menu` role.
Previously we wouldn't compute any name for `menu` to pass some web-platform-tests that covered an exotic use case.
Now we correctly respect name from author (e.g. `aria-label` or `aria-labelledby`).
## 0.5.8
### Patch Changes
- [#343](https://github.com/eps1lon/dom-accessibility-api/pull/343) [`3d755c2`](https://github.com/eps1lon/dom-accessibility-api/commit/3d755c2b851d7e5da762494559347dfcc25a6654) Thanks [@eps1lon](https://github.com/eps1lon)! - Add `isInaccessible` and `isSubtreeInaccessible`.
`isInaccessible` implements https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion.
`isSubtreeInaccessible` can be used to inject a memoized version of that function into `isInaccessible`.
## 0.5.7
### Patch Changes
- [#718](https://github.com/eps1lon/dom-accessibility-api/pull/718) [`6154760`](https://github.com/eps1lon/dom-accessibility-api/commit/61547602a7676167a65a893be53c3cf6b4e010b5) Thanks [@calebeby](https://github.com/calebeby)! - Remove implicit "document" role on `
` and add it to ``
## 0.5.6
### Patch Changes
- [#666](https://github.com/eps1lon/dom-accessibility-api/pull/666) [`26ee73d`](https://github.com/eps1lon/dom-accessibility-api/commit/26ee73de9ad6fce27cde0d5ec53a2bc4a12bd879) Thanks [@eps1lon](https://github.com/eps1lon)! - Consider ` ` when computing the accessible name of ` `
Given
```html
Output Label
```
Previously the accessible name of the ` ` would ignore the ` `.
However, an [` ` is labelable](https://html.spec.whatwg.org/#the-output-element) and therefore the accessible name is now computed using ` ` elements if they exists.
In this example the accessible name is `"Output Label"`.
## 0.5.5
### Patch Changes
- [#627](https://github.com/eps1lon/dom-accessibility-api/pull/627) [`0485441`](https://github.com/eps1lon/dom-accessibility-api/commit/0485441e68cf728596d7140bdff2ac13280eefab) Thanks [@eps1lon](https://github.com/eps1lon)! - Ensure certain babel helpers aren't required
Source:
```diff
-const [item] = list;
+const item = list[0];
```
Transpiled:
```diff
-var _trim$split = list.trim().split(" "),
-_trim$split2 = _slicedToArray(_trim$split, 1),
-item = _trim$split2[0]
+var item = list[0];
```
* [#629](https://github.com/eps1lon/dom-accessibility-api/pull/629) [`383bdb6`](https://github.com/eps1lon/dom-accessibility-api/commit/383bdb616c00105474c8607dd9e5aab4deaff7ed) Thanks [@eps1lon](https://github.com/eps1lon)! - Use label attribute for naming of `` elements.
Given
```jsx
bar
```
Previously the ` ` would not have an accessible name.
Though [2D in `accname` 1.2](https://www.w3.org/TR/accname-1.2/) could be interpreted to use the `label` attribute:
> Otherwise, if the current node's native markup provides an attribute (e.g. title) or element (e.g. HTML label) that defines a text alternative, return that alternative [...]
This was confirmed in NVDA + FireFox.
## 0.5.4
### Patch Changes
- [`3866289`](https://github.com/eps1lon/dom-accessibility-api/commit/3866289a6ad92b73a8c031a2983165e1b1f2b24c) [#442](https://github.com/eps1lon/dom-accessibility-api/pull/442) Thanks [@geoffrich](https://github.com/geoffrich)! - Correctly determine accessible name when element contains a slot.
Previously, computing the accessible name would only examine child nodes. However, content placed in a slot is is an assigned node, not a child node.
If you have a custom element `custom-button` with a slot:
```html
Custom name
```
If you have a custom element `custom-button-default` with default content in the slot:
```html
Default name
Custom name
```
This is not currently defined in the accname spec but reflects current browser behavior.
## 0.5.3
### Patch Changes
- [`76e8f93`](https://github.com/eps1lon/dom-accessibility-api/commit/76e8f93ccd8d6d3464d1b362a22163c501b9ea37) [#430](https://github.com/eps1lon/dom-accessibility-api/pull/430) Thanks [@ckundo](https://github.com/ckundo)! - Maintain `img` role for `img` with missing `alt` attribute.
Previously ` ` would be treated the same as ` `.
` ` is now treated as `role="img"` [as specified](https://w3c.github.io/html-aam/#el-img-empty-alt).
* [`96d4438`](https://github.com/eps1lon/dom-accessibility-api/commit/96d443855b897fccb9fa09d5f595c502b23e6cf9) [#436](https://github.com/eps1lon/dom-accessibility-api/pull/436) Thanks [@eps1lon](https://github.com/eps1lon)! - Resolve presentational role conflicts when global WAI-ARIA states or properties (ARIA attributes) are used.
` ` used to have no role.
[By spec](https://w3c.github.io/html-aam/#el-img-empty-alt) it should have `role="presentation"` with no ARIA attributes or `role="img"` [otherwise](https://rawgit.com/w3c/aria/stable/#conflict_resolution_presentation_none).
## 0.5.2
### Patch Changes
- [`03273b7`](https://github.com/eps1lon/dom-accessibility-api/commit/03273b7d91a156a6dd9c727293a491cd2d1f02f1) [#406](https://github.com/eps1lon/dom-accessibility-api/pull/406) Thanks [@eps1lon](https://github.com/eps1lon)! - Fix various issues for input types `submit`, `reset` and `image`
Prefer input `value` when `type` is `reset` or `submit`:
```diff
-// accessible name: "Submit"
+// accessible name: "Submit values"
-// accessible name: "Reset"
+// accessible name: "Reset form"
```
For input `type` `image` consider `alt` attribute or fall back to `"Submit query"`.
## 0.5.1
### Patch Changes
- [`fcc66ae`](https://github.com/eps1lon/dom-accessibility-api/commit/fcc66aef833b8c7546921800e09cbb2096ef9601) [#394](https://github.com/eps1lon/dom-accessibility-api/pull/394) Thanks [@marcosvega91](https://github.com/marcosvega91)! - Ignore `title` attribute if it is empty.
Previously `Hello, Dave! ` would wrongly compute an empty name.
## 0.5.0
### Minor Changes
- [`9e46c51`](https://github.com/eps1lon/dom-accessibility-api/commit/9e46c51b51993c65237efd4b0d046f1a35c3e76a) [#380](https://github.com/eps1lon/dom-accessibility-api/pull/380) Thanks [@eps1lon](https://github.com/eps1lon)! - **BREAKING CHANGE**
Ignore `::before` and `::after` by default.
This was necessary to prevent excessive warnings in `jsdom@^16.4.0`.
If you use this package in a browser that supports the second argument of `window.getComputedStyle` you can set the `computedStyleSupportsPseudoElements` option to true:
```ts
computeAccessibleName(element, {
computedStyleSupportsPseudoElements: true
});
computeAccessibleDescription(element, {
computedStyleSupportsPseudoElements: true
});
```
If you pass a custom implementation of `getComputedStyle` then this option defaults to `true`.
The following two calls are equivalent:
```ts
computeAccessibleName(element, {
computedStyleSupportsPseudoElements: true
});
computeAccessibleName(element, {
getComputedStyle: (element, pseudoElement) => {
// custom implementation
}
});
```
### Patch Changes
- [`5db24b1`](https://github.com/eps1lon/dom-accessibility-api/commit/5db24b1fa0c75a5914526de1c58da54db294f405) [#368](https://github.com/eps1lon/dom-accessibility-api/pull/368) Thanks [@eps1lon](https://github.com/eps1lon)! - Use `localName` to determine elements instead of `tagName`.
## 0.4.7
### Patch Changes
- [`d6c4455`](https://github.com/eps1lon/dom-accessibility-api/commit/d6c44558250e898caa68e7b3eaa2f4d505078b3e) [#352](https://github.com/eps1lon/dom-accessibility-api/pull/352) Thanks [@eps1lon](https://github.com/eps1lon)! - Support native labels in IE 11
Also affects Edge < 18 and Firefox < 56.
## 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 `` for the name of its `` 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
### Patch Changes
- [`d668f72`](https://github.com/eps1lon/dom-accessibility-api/commit/d668f724aeb42cb71d720e0acd3518a03bbbee6e) [#273](https://github.com/eps1lon/dom-accessibility-api/pull/273) Thanks [@eps1lon](https://github.com/eps1lon)! - fix: Concatenate text nodes without space
Fixes `Hello {name}! ` in `react` computing `"Hello name !"` instead of `Hello name!`.
## 0.4.4
### Patch Changes
- [`e79f620`](https://github.com/eps1lon/dom-accessibility-api/commit/e79f6209667b3b2de656a73dec0eea37c65d48a9) [#208](https://github.com/eps1lon/dom-accessibility-api/pull/208) Thanks [@eps1lon](https://github.com/eps1lon)! - Add support for node 14
* [`2c6a23b`](https://github.com/eps1lon/dom-accessibility-api/commit/2c6a23b3ec3e514d7db631e393749fac0ab33b5b) [#200](https://github.com/eps1lon/dom-accessibility-api/pull/200) Thanks [@eps1lon](https://github.com/eps1lon)! - Add `module` field
- [`737dfae`](https://github.com/eps1lon/dom-accessibility-api/commit/737dfae2b88a4ce94d59144a6aabf69f0a671edc) [#234](https://github.com/eps1lon/dom-accessibility-api/pull/234) Thanks [@willamzv](https://github.com/willamzv)! - Consider `` for the name of its ` ` element.
```html
my fieldset
```
Computing the name for this fieldset would've returned an empty string previously. It now correctly computes `my fieldset` following the [accessible name computation for `fieldset` elements](https://w3c.github.io/html-aam/#fieldset-and-legend-elements)
* [`969da7d`](https://github.com/eps1lon/dom-accessibility-api/commit/969da7d454b3d83dc7259d910f40e7e16a6eb560) [#240](https://github.com/eps1lon/dom-accessibility-api/pull/240) Thanks [@eps1lon](https://github.com/eps1lon)! - Reduce over-transpilation
Switched from
- `for-of` to `.forEach` or a basic `for` loop
- `array.push(...otherArray)` to `push.apply(array, otherArray)`
This removed a bunch of babel junk that wasn't needed.
- [`d578329`](https://github.com/eps1lon/dom-accessibility-api/commit/d5783292ca49ae947bd95559030aa2c93c04565f) [#248](https://github.com/eps1lon/dom-accessibility-api/pull/248) Thanks [@eps1lon](https://github.com/eps1lon)! - Consider `` for the name of its `` element.
```html
```
Computing the name for this table would've returned an empty string previously. It now correctly computes `my table` following the [accessible name computation for `table` elements](https://w3c.github.io/html-aam/#table-element)
* [`f1b2bd0`](https://github.com/eps1lon/dom-accessibility-api/commit/f1b2bd0434cafe65812acfb0e3a2942309eb9726) [#237](https://github.com/eps1lon/dom-accessibility-api/pull/237) Thanks [@eps1lon](https://github.com/eps1lon)! - Use nodeType and tagName for element type checks
## 0.4.3
### Patch Changes
- [`b421d9e`](https://github.com/eps1lon/dom-accessibility-api/commit/b421d9e9709adf0f72e09cb5d7ea2a32ceefd8eb) [#168](https://github.com/eps1lon/dom-accessibility-api/pull/168) Thanks [@eps1lon](https://github.com/eps1lon)! - fix: Use relative paths in exports field
Fixes a crash when using ES modules in Node.
## 0.4.2
### Minor Changes
- [`0897630`](https://github.com/eps1lon/dom-accessibility-api/commit/0897630862d608a9ca22e9799bb30b37e1032afa) [#155](https://github.com/eps1lon/dom-accessibility-api/pull/155) - Publish version using ES6 modules allongside current CommonJS modules
## 0.4.1
### Patch Changes
- [`63c119f`](https://github.com/eps1lon/dom-accessibility-api/commit/63c119f388d4e0f121320d75c4ec6fe334d8f370) [#147](https://github.com/eps1lon/dom-accessibility-api/pull/147) Thanks [@eps1lon](https://github.com/eps1lon)! - Deploy all 0.4.0 changes
## 0.4.0
### Minor Changes
- [`e80a1fb`](https://github.com/eps1lon/dom-accessibility-api/commit/e80a1fb32c136539a46007a64ef8c998855080a1) [#141](https://github.com/eps1lon/dom-accessibility-api/pull/141) Thanks [@eps1lon](https://github.com/eps1lon)! - Support ES5 environments
### Patch Changes
- [`bd41c2d`](https://github.com/eps1lon/dom-accessibility-api/commit/bd41c2d3dec9c27e178b65bbe226d3c7adef0678) [#143](https://github.com/eps1lon/dom-accessibility-api/pull/143) Thanks [@eps1lon](https://github.com/eps1lon)! - fix: support `` for `` and `