Skip to content

Commit

Permalink
remove redundant role
Browse files Browse the repository at this point in the history
  • Loading branch information
claviska committed Nov 12, 2021
1 parent b98b10c commit a24eaa6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/resources/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/components/dropdown/dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}
>
Expand Down
5 changes: 4 additions & 1 deletion src/components/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit a24eaa6

Please sign in to comment.