remove redundant role

pull/590/head
Cory LaViska 2021-11-12 09:50:50 -05:00
rodzic b98b10c580
commit a24eaa6693
3 zmienionych plików z 6 dodań i 2 usunięć

Wyświetl plik

@ -8,6 +8,8 @@ _During the beta period, these restrictions may be relaxed in the event of a mis
## Next ## Next
- Moved `role` from the shadow root to the host element in `<sl-menu>`
- Removed redundant `role="menu"` in `<sl-dropdown>`
- Slightly faster animations for showing and hiding `<sl-dropdown>` - Slightly faster animations for showing and hiding `<sl-dropdown>`
## 2.0.0-beta.60 ## 2.0.0-beta.60

Wyświetl plik

@ -425,7 +425,6 @@ export default class SlDropdown extends LitElement {
<div <div
part="panel" part="panel"
class="dropdown__panel" class="dropdown__panel"
role="menu"
aria-hidden=${this.open ? 'false' : 'true'} aria-hidden=${this.open ? 'false' : 'true'}
aria-labelledby=${this.componentId} aria-labelledby=${this.componentId}
> >

Wyświetl plik

@ -26,6 +26,10 @@ export default class SlMenu extends LitElement {
private typeToSelectString = ''; private typeToSelectString = '';
private typeToSelectTimeout: any; private typeToSelectTimeout: any;
firstUpdated() {
this.setAttribute('role', 'menu');
}
getAllItems(options: { includeDisabled: boolean } = { includeDisabled: true }) { getAllItems(options: { includeDisabled: boolean } = { includeDisabled: true }) {
return [...this.defaultSlot.assignedElements({ flatten: true })].filter((el: HTMLElement) => { return [...this.defaultSlot.assignedElements({ flatten: true })].filter((el: HTMLElement) => {
if (el.getAttribute('role') !== 'menuitem') { if (el.getAttribute('role') !== 'menuitem') {
@ -183,7 +187,6 @@ export default class SlMenu extends LitElement {
<div <div
part="base" part="base"
class="menu" class="menu"
role="menu"
@click=${this.handleClick} @click=${this.handleClick}
@keydown=${this.handleKeyDown} @keydown=${this.handleKeyDown}
@keyup=${this.handleKeyUp} @keyup=${this.handleKeyUp}