fix(button): make button more accessible
This commit is contained in:
parent
66d3d390ae
commit
fdedcf2894
2 changed files with 8 additions and 1 deletions
|
|
@ -92,7 +92,7 @@ export class LionButton extends DisabledWithTabIndexMixin(SlotMixin(LitElement))
|
|||
padding: 0;
|
||||
}
|
||||
|
||||
:host(:focus) .btn {
|
||||
:host(:focus:not([disabled])) .btn {
|
||||
/* if you extend, please overwrite */
|
||||
outline: 2px solid #bde4ff;
|
||||
}
|
||||
|
|
@ -137,6 +137,7 @@ export class LionButton extends DisabledWithTabIndexMixin(SlotMixin(LitElement))
|
|||
if (!this.constructor._button) {
|
||||
this.constructor._button = document.createElement('button');
|
||||
this.constructor._button.setAttribute('tabindex', '-1');
|
||||
this.constructor._button.setAttribute('aria-hidden', true);
|
||||
}
|
||||
return this.constructor._button.cloneNode();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -222,6 +222,12 @@ describe('lion-button', () => {
|
|||
);
|
||||
restoreMockIsIE11();
|
||||
});
|
||||
|
||||
it.only('has a native button node with aria-hidden set to true', async () => {
|
||||
const el = await fixture('<lion-button></lion-button>');
|
||||
|
||||
expect(el._nativeButtonNode.getAttribute('aria-hidden')).to.equal('true');
|
||||
});
|
||||
});
|
||||
|
||||
describe('form integration', () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue