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

Function _getMenuItem

src/aria/private/menu/menu.ts:937–947  ·  view source on GitHub ↗

Returns the menu item matching the given event target within `items`.

(
  event: Event,
  items: MenuItemPattern<V>[],
)

Source from the content-addressed store, hash-verified

935
936/** Returns the menu item matching the given event target within `items`. */
937function _getMenuItem<V>(
938 event: Event,
939 items: MenuItemPattern<V>[],
940): MenuItemPattern<V> | undefined {
941 const target = _getEventTarget(event);
942 if (!(target instanceof Element)) {
943 return undefined;
944 }
945 const element = target.closest('[role^="menuitem"]');
946 return element ? items.find(i => i.element() === element) : undefined;
947}

Callers 2

onFocusInMethod · 0.85
onFocusInMethod · 0.85

Calls 2

_getEventTargetFunction · 0.90
elementMethod · 0.45

Tested by

no test coverage detected