fix(tooltip): add aria role
This commit is contained in:
parent
be6e25467a
commit
b8e9926056
2 changed files with 12 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ export class LionTooltip extends LionPopup {
|
|||
super.connectedCallback();
|
||||
this.contentNode = this.querySelector('[slot="content"]');
|
||||
this.invokerNode = this.querySelector('[slot="invoker"]');
|
||||
this.contentNode.setAttribute('role', 'tooltip');
|
||||
|
||||
this._controller = overlays.add(
|
||||
new LocalOverlayController({
|
||||
|
|
|
|||
|
|
@ -68,6 +68,17 @@ describe('lion-tooltip', () => {
|
|||
expect(el.querySelector('[slot="content"]').style.display).to.be.equal('none');
|
||||
});
|
||||
|
||||
it('should have a tooltip role set on the tooltip', async () => {
|
||||
const el = await fixture(html`
|
||||
<lion-tooltip>
|
||||
<div slot="content">Hey there</div>
|
||||
<lion-button slot="invoker">Tooltip button</lion-button>
|
||||
</lion-tooltip>
|
||||
`);
|
||||
const invoker = el.querySelector('[slot="content"]');
|
||||
expect(invoker.getAttribute('role')).to.be.equal('tooltip');
|
||||
});
|
||||
|
||||
it('should have aria-controls attribute set to the invoker', async () => {
|
||||
const el = await fixture(html`
|
||||
<lion-tooltip>
|
||||
|
|
|
|||
Loading…
Reference in a new issue