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

Method _resolvePanel

src/material/menu/menu.ts:526–538  ·  view source on GitHub ↗

Gets the menu panel DOM node.

()

Source from the content-addressed store, hash-verified

524
525 /** Gets the menu panel DOM node. */
526 private _resolvePanel(): HTMLElement | null {
527 let menuPanel: HTMLElement | null = null;
528
529 if (this._directDescendantItems.length) {
530 // Because the `mat-menuPanel` is at the DOM insertion point, not inside the overlay, we don't
531 // have a nice way of getting a hold of the menuPanel panel. We can't use a `ViewChild` either
532 // because the panel is inside an `ng-template`. We work around it by starting from one of
533 // the items and walking up the DOM.
534 menuPanel = this._directDescendantItems.first!._getHostElement().closest('[role="menu"]');
535 }
536
537 return menuPanel;
538 }
539}

Callers 2

focusFirstItemMethod · 0.95
_setIsOpenMethod · 0.95

Calls 1

_getHostElementMethod · 0.45

Tested by

no test coverage detected