Skip to content

Commit 86062ae

Browse files
authored
feat: focus method for menu-item (#789)
1 parent c1a2aa4 commit 86062ae

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/uui-menu-item/lib/uui-menu-item.element.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
113113
demandCustomElement(this, 'uui-loader-bar');
114114
}
115115

116+
async focus() {
117+
await this.updateComplete;
118+
this.shadowRoot
119+
?.querySelector<
120+
HTMLButtonElement | HTMLAnchorElement | HTMLSpanElement
121+
>('#label-button')
122+
?.focus?.();
123+
}
124+
116125
private _labelButtonChanged = (label?: Element | undefined) => {
117126
this.selectableTarget = label || this;
118127
};

0 commit comments

Comments
 (0)