* Subscribe to the mouseenter events and close any sibling menu items if this element is moused * into.
()
| 228 | * into. |
| 229 | */ |
| 230 | private _subscribeToMouseEnter() { |
| 231 | this._cleanupMouseenter = this._ngZone.runOutsideAngular(() => { |
| 232 | return this._renderer.listen(this._elementRef.nativeElement, 'mouseenter', () => { |
| 233 | if ( |
| 234 | // Skip fake `mouseenter` events dispatched by touch devices. |
| 235 | this._inputModalityDetector.mostRecentModality !== 'touch' && |
| 236 | !this.menuStack.isEmpty() && |
| 237 | !this.isOpen() |
| 238 | ) { |
| 239 | // Closes any sibling menu items and opens the menu associated with this trigger. |
| 240 | const toggleMenus = () => |
| 241 | this._ngZone.run(() => { |
| 242 | this._closeSiblingTriggers(); |
| 243 | this.open(); |
| 244 | }); |
| 245 | |
| 246 | if (this._menuAim) { |
| 247 | this._menuAim.toggle(toggleMenus); |
| 248 | } else { |
| 249 | toggleMenus(); |
| 250 | } |
| 251 | } |
| 252 | }); |
| 253 | }); |
| 254 | } |
| 255 | |
| 256 | /** Close out any sibling menu trigger menus. */ |
| 257 | private _closeSiblingTriggers() { |
no test coverage detected