fix(overlays): add aria-hidden to arrow (#2030)
This commit is contained in:
parent
b340fd7a6c
commit
5eafa1ffc1
4 changed files with 23 additions and 2 deletions
5
.changeset/little-worms-exist.md
Normal file
5
.changeset/little-worms-exist.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@lion/ui': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
hide overlay arrow from screen readers
|
||||||
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -22393,7 +22393,7 @@
|
||||||
},
|
},
|
||||||
"packages/ui": {
|
"packages/ui": {
|
||||||
"name": "@lion/ui",
|
"name": "@lion/ui",
|
||||||
"version": "0.3.1",
|
"version": "0.3.4",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bundled-es-modules/message-format": "^6.0.4",
|
"@bundled-es-modules/message-format": "^6.0.4",
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,9 @@ export const ArrowMixinImplementation = superclass =>
|
||||||
|
|
||||||
/** @protected */
|
/** @protected */
|
||||||
_arrowNodeTemplate() {
|
_arrowNodeTemplate() {
|
||||||
return html` <div class="arrow" data-popper-arrow>${this._arrowTemplate()}</div> `;
|
return html`
|
||||||
|
<div class="arrow" aria-hidden="true" data-popper-arrow>${this._arrowTemplate()}</div>
|
||||||
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @protected */
|
/** @protected */
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,20 @@ describe('ArrowMixin', () => {
|
||||||
expect(window.getComputedStyle(arrowNode).getPropertyValue('display')).to.equal('block');
|
expect(window.getComputedStyle(arrowNode).getPropertyValue('display')).to.equal('block');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('hides for screen readers', async () => {
|
||||||
|
const el = /** @type {ArrowTest} */ (
|
||||||
|
await fixture(html`
|
||||||
|
<arrow-test>
|
||||||
|
<div slot="content">This is a tooltip</div>
|
||||||
|
<button slot="invoker">Tooltip button</button>
|
||||||
|
</arrow-test>
|
||||||
|
`)
|
||||||
|
);
|
||||||
|
|
||||||
|
const arrowNode = /** @type {Element} */ (el._arrowNode);
|
||||||
|
expect(arrowNode.getAttribute('aria-hidden')).to.equal('true');
|
||||||
|
});
|
||||||
|
|
||||||
it('hides the arrow when has-arrow is false', async () => {
|
it('hides the arrow when has-arrow is false', async () => {
|
||||||
const el = /** @type {ArrowTest} */ (
|
const el = /** @type {ArrowTest} */ (
|
||||||
await fixture(html`
|
await fixture(html`
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue