remove redundant role

This commit is contained in:
Cory LaViska
2021-11-12 09:50:50 -05:00
parent b98b10c580
commit a24eaa6693
3 changed files with 6 additions and 2 deletions

View File

@@ -8,6 +8,8 @@ _During the beta period, these restrictions may be relaxed in the event of a mis
## 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>`
## 2.0.0-beta.60

View File

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

View File

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