MCPcopy Create free account
hub / github.com/angular/components / pendingFocusEffect

Method pendingFocusEffect

src/aria/private/menu/menu.ts:706–721  ·  view source on GitHub ↗

Flushes any pending focus when the menu instance becomes available.

()

Source from the content-addressed store, hash-verified

704
705 /** Flushes any pending focus when the menu instance becomes available. */
706 pendingFocusEffect(): void {
707 const menu = this.inputs.menu();
708 const intent = this.pendingFocus();
709 const items = menu?.items();
710
711 // We check the items so that we don't try calling into
712 // `first/last` until the items are actually available.
713 if (menu && intent && items?.length) {
714 if (intent === 'first') {
715 menu.first();
716 } else if (intent === 'last') {
717 menu.last();
718 }
719 this.pendingFocus.set(undefined);
720 }
721 }
722
723 /** Handles keyboard events for the menu trigger. */
724 onKeydown(event: KeyboardEvent) {

Callers 1

getMenuTriggerPatternFunction · 0.95

Calls 4

setMethod · 0.80
menuMethod · 0.45
firstMethod · 0.45
lastMethod · 0.45

Tested by 1

getMenuTriggerPatternFunction · 0.76