dom-accessibility-api changelog
0.5.4
Patch Changes
-
3866289
#442 Thanks @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:
<button><slot></slot></button>
<!-- accname of inner <button> is 'Custom name' (previously '') -->
<custom-button>Custom name</custom-button>
If you have a custom element custom-button-default
with default content in the slot:
<button><slot>Default name</slot></button>
<!-- accname of inner <button> is 'Custom name' (previously 'Default name') -->
<custom-button-default>Custom name</custom-button-default>
<!-- accname of inner <button> is 'Default name' (previously 'Default name') -->
<custom-button-default></custom-button-default>
This is not currently defined in the accname spec but reflects current browser behavior.
0.5.3
Patch Changes
Previously <img />
would be treated the same as <img alt />
.
<img />
is now treated as role="img"
as specified.
-
96d4438
#436 Thanks @eps1lon! - Resolve presentational role conflicts when global WAI-ARIA states or properties (ARIA attributes) are used.
<img alt="" />
used to have no role.
By spec it should have role="presentation"
with no ARIA attributes or role="img"
otherwise.
0.5.2
Patch Changes
Prefer input value
when type
is reset
or submit
:
<input type="submit" value="Submit values">
-// accessible name: "Submit"
+// accessible name: "Submit values"
<input type="reset" value="Reset form">
-// 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
#394 Thanks @marcosvega91! - Ignoretitle
attribute if it is empty.
Previously <button title="">Hello, Dave!</button>
would wrongly compute an empty name.
0.5.0
Minor Changes
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:
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:
computeAccessibleName(element, {
computedStyleSupportsPseudoElements: true
});
computeAccessibleName(element, {
getComputedStyle: (element, pseudoElement) => {
// custom implementation
}
});
Patch Changes
0.4.7
Patch Changes
Also affects Edge < 18 and Firefox < 56.
0.4.6
Patch Changes
We only stopped testing. Probability of breakage should be very low.
New policy:
Only active node versions are supported. Inactive node versions can stop working in a SemVer MINOR release.
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
Fixes <h1>Hello {name}!</h1>
in react
computing "Hello name !"
instead of Hello name!
.
0.4.4
Patch Changes
<fieldset>
<legend><em>my</em> fieldset</legend>
</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
Switched from
-
for-of
to.forEach
or a basicfor
loop -
array.push(...otherArray)
topush.apply(array, otherArray)
This removed a bunch of babel junk that wasn't needed.
<table>
<caption>
<em>my</em>
table
</caption>
</table>
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
0.4.3
Patch Changes
Fixes a crash when using ES modules in Node.
0.4.2
Minor Changes
0.4.1
Patch Changes
0.4.0
Minor Changes
Patch Changes
0.3.0
Minor Changes
- 7f1ada0: Internal polish
0.2.0
Minor Changes
- eb86842: Add option to mock window.getComputedStyle
This option has two use cases in mind:
- fake the style and assume everything is visible. This increases performance (window.getComputedStyle) is expensive) by not distinguishing between various levels of visual impairments. If one can't see the name with a screen reader then neither will a sighted user
- Wrap a cache provider around
window.getComputedStyle
. We don't implement any because the returnedCSSStyleDeclaration
is only live in a browser.jsdom
does not implement live declarations.