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

Method onFocusOut

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

Handles focusout events for the menu trigger.

(event: FocusEvent)

Source from the content-addressed store, hash-verified

719
720 /** Handles focusout events for the menu trigger. */
721 onFocusOut(event: FocusEvent) {
722 const element = this.inputs.element();
723 const relatedTarget = event.relatedTarget as Node | null;
724
725 if (
726 this.expanded() &&
727 !element?.contains(relatedTarget) &&
728 !this.inputs.menu()?.inputs.element()?.contains(relatedTarget)
729 ) {
730 this.close();
731 }
732 }
733
734 /** Opens the menu. */
735 open(opts?: {first?: boolean; last?: boolean}) {

Callers

nothing calls this directly

Calls 4

closeMethod · 0.95
expandedMethod · 0.80
elementMethod · 0.45
menuMethod · 0.45

Tested by

no test coverage detected