fix(combobox): aria-expanded always on elm with role=combobox
This commit is contained in:
parent
0dc706b6f9
commit
e301ef9657
3 changed files with 36 additions and 0 deletions
7
.changeset/sour-books-dress.md
Normal file
7
.changeset/sour-books-dress.md
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
'@lion/combobox': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
**combobox**: aria-expanded always applied on element with role=combobox
|
||||||
|
|
@ -740,6 +740,7 @@ export class LionCombobox extends OverlayMixin(LionListbox) {
|
||||||
return /** @type {OverlayConfig} */ ({
|
return /** @type {OverlayConfig} */ ({
|
||||||
...withDropdownConfig(),
|
...withDropdownConfig(),
|
||||||
elementToFocusAfterHide: undefined,
|
elementToFocusAfterHide: undefined,
|
||||||
|
invokerNode: this._comboboxNode,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -708,6 +708,34 @@ describe('lion-combobox', () => {
|
||||||
expect(comboboxNode.getAttribute('role')).to.equal('combobox');
|
expect(comboboxNode.getAttribute('role')).to.equal('combobox');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('sets aria-expanded to element with role="combobox" in wai-aria 1.0 and 1.1', async () => {
|
||||||
|
const el = /** @type {LionCombobox} */ (await fixture(html`
|
||||||
|
<lion-combobox name="foo" ._ariaVersion="${'1.0'}">
|
||||||
|
<lion-option .choiceValue="${'10'}" checked>Item 1</lion-option>
|
||||||
|
<lion-option .choiceValue="${'20'}">Item 2</lion-option>
|
||||||
|
</lion-combobox>
|
||||||
|
`));
|
||||||
|
const { comboboxNode } = getProtectedMembers(el);
|
||||||
|
|
||||||
|
expect(comboboxNode.getAttribute('aria-expanded')).to.equal('false');
|
||||||
|
el.opened = true;
|
||||||
|
await el.updateComplete;
|
||||||
|
expect(comboboxNode.getAttribute('aria-expanded')).to.equal('true');
|
||||||
|
|
||||||
|
const el2 = /** @type {LionCombobox} */ (await fixture(html`
|
||||||
|
<lion-combobox name="foo" ._ariaVersion="${'1.1'}">
|
||||||
|
<lion-option .choiceValue="${'10'}" checked>Item 1</lion-option>
|
||||||
|
<lion-option .choiceValue="${'20'}">Item 2</lion-option>
|
||||||
|
</lion-combobox>
|
||||||
|
`));
|
||||||
|
const { comboboxNode: comboboxNode2 } = getProtectedMembers(el2);
|
||||||
|
|
||||||
|
expect(comboboxNode2.getAttribute('aria-expanded')).to.equal('false');
|
||||||
|
el2.opened = true;
|
||||||
|
await el2.updateComplete;
|
||||||
|
expect(comboboxNode.getAttribute('aria-expanded')).to.equal('true');
|
||||||
|
});
|
||||||
|
|
||||||
it('makes sure listbox node is not focusable', async () => {
|
it('makes sure listbox node is not focusable', async () => {
|
||||||
const el = /** @type {LionCombobox} */ (await fixture(html`
|
const el = /** @type {LionCombobox} */ (await fixture(html`
|
||||||
<lion-combobox name="foo">
|
<lion-combobox name="foo">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue