MCPcopy Index your code
hub / github.com/angular/components / _setupMouseEnter

Method _setupMouseEnter

src/cdk/menu/menu-item.ts:286–308  ·  view source on GitHub ↗

* Subscribe to the mouseenter events and close any sibling menu items if this element is moused * into.

()

Source from the content-addressed store, hash-verified

284 * into.
285 */
286 private _setupMouseEnter() {
287 if (!this._isStandaloneItem()) {
288 const closeOpenSiblings = () =>
289 this._ngZone.run(() => this._menuStack.closeSubMenuOf(this._parentMenu!));
290
291 this._cleanupMouseEnter = this._ngZone.runOutsideAngular(() =>
292 this._renderer.listen(this._elementRef.nativeElement, 'mouseenter', () => {
293 // Skip fake `mouseenter` events dispatched by touch devices.
294 if (
295 this._inputModalityDetector.mostRecentModality !== 'touch' &&
296 !this._menuStack.isEmpty() &&
297 !this.hasMenu
298 ) {
299 if (this._menuAim) {
300 this._menuAim.toggle(closeOpenSiblings);
301 } else {
302 closeOpenSiblings();
303 }
304 }
305 }),
306 );
307 }
308 }
309
310 /**
311 * Return true if the enclosing parent menu is configured in a horizontal orientation, false

Callers 1

constructorMethod · 0.95

Calls 4

_isStandaloneItemMethod · 0.95
listenMethod · 0.80
toggleMethod · 0.65
isEmptyMethod · 0.45

Tested by

no test coverage detected