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

Function _getMenuItem

src/aria/private/menu/menu.ts:928–938  ·  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

926
927/** Returns the menu item matching the given event target within `items`. */
928function _getMenuItem<V>(
929 event: Event,
930 items: MenuItemPattern<V>[],
931): MenuItemPattern<V> | undefined {
932 const target = _getEventTarget(event);
933 if (!(target instanceof Element)) {
934 return undefined;
935 }
936 const element = target.closest('[role^="menuitem"]');
937 return element ? items.find(i => i.element() === element) : undefined;
938}

Callers 2

onFocusInMethod · 0.85
onFocusInMethod · 0.85

Calls 2

_getEventTargetFunction · 0.90
elementMethod · 0.45

Tested by

no test coverage detected