Skip to content

Commit

Permalink
focus method for menu-item
Browse files Browse the repository at this point in the history
  • Loading branch information
nielslyngsoe committed Apr 22, 2024
1 parent e159c43 commit f172ba2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/uui-menu-item/lib/uui-menu-item.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
demandCustomElement(this, 'uui-loader-bar');
}

async focus() {
await this.updateComplete;
this.shadowRoot
?.querySelector<
HTMLButtonElement | HTMLAnchorElement | HTMLSpanElement
>('#label-button')
?.focus?.();
}

private _labelButtonChanged = (label?: Element | undefined) => {
this.selectableTarget = label || this;
};
Expand Down

0 comments on commit f172ba2

Please sign in to comment.