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

Method pendingFocusEffect

src/aria/private/menu/menu.ts:715–730  ·  view source on GitHub ↗

Flushes any pending focus when the menu instance becomes available.

()

Source from the content-addressed store, hash-verified

713
714 /** Flushes any pending focus when the menu instance becomes available. */
715 pendingFocusEffect(): void {
716 const menu = this.inputs.menu();
717 const intent = this.pendingFocus();
718 const items = menu?.items();
719
720 // We check the items so that we don't try calling into
721 // `first/last` until the items are actually available.
722 if (menu && intent && items?.length) {
723 if (intent === 'first') {
724 menu.first();
725 } else if (intent === 'last') {
726 menu.last();
727 }
728 this.pendingFocus.set(undefined);
729 }
730 }
731
732 /** Handles keyboard events for the menu trigger. */
733 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