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

Method onMouseOver

src/aria/private/menu/menu.ts:230–263  ·  view source on GitHub ↗

Handles mouseover events for the menu.

(event: MouseEvent)

Source from the content-addressed store, hash-verified

228
229 /** Handles mouseover events for the menu. */
230 onMouseOver(event: MouseEvent) {
231 if (!this.visible()) {
232 return;
233 }
234
235 this.hasBeenHovered.set(true);
236 const item = this.inputs.items().find(i => i.element()?.contains(_getEventTarget(event)));
237
238 if (!item) {
239 return;
240 }
241
242 const parent = this.inputs.parent();
243 const activeItem = this.inputs.activeItem();
244
245 if (parent instanceof MenuItemPattern) {
246 const grandparent = parent.inputs.parent();
247 if (grandparent instanceof MenuPattern) {
248 grandparent._clearTimeouts();
249 grandparent.listBehavior.goto(parent, {focusElement: false});
250 }
251 }
252
253 if (activeItem && activeItem !== item) {
254 this._closeItem(activeItem);
255 }
256
257 if (item.expanded()) {
258 this._clearCloseTimeout();
259 }
260
261 this._openItem(item);
262 this.listBehavior.goto(item, {focusElement: this.shouldFocus()});
263 }
264
265 /** Closes the specified menu item after a delay. */
266 private _closeItem(item: MenuItemPattern<V>) {

Callers 1

menu.spec.tsFile · 0.45

Calls 12

_closeItemMethod · 0.95
_clearCloseTimeoutMethod · 0.95
_openItemMethod · 0.95
_getEventTargetFunction · 0.90
visibleMethod · 0.80
setMethod · 0.80
parentMethod · 0.80
activeItemMethod · 0.80
_clearTimeoutsMethod · 0.80
expandedMethod · 0.80
elementMethod · 0.45
gotoMethod · 0.45

Tested by

no test coverage detected