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

Method onMouseOver

src/aria/private/menu/menu.ts:239–272  ·  view source on GitHub ↗

Handles mouseover events for the menu.

(event: MouseEvent)

Source from the content-addressed store, hash-verified

237
238 /** Handles mouseover events for the menu. */
239 onMouseOver(event: MouseEvent) {
240 if (!this.visible()) {
241 return;
242 }
243
244 this.hasBeenHovered.set(true);
245 const item = this.inputs.items().find(i => i.element()?.contains(_getEventTarget(event)));
246
247 if (!item) {
248 return;
249 }
250
251 const parent = this.inputs.parent();
252 const activeItem = this.inputs.activeItem();
253
254 if (parent instanceof MenuItemPattern) {
255 const grandparent = parent.inputs.parent();
256 if (grandparent instanceof MenuPattern) {
257 grandparent._clearTimeouts();
258 grandparent.listBehavior.goto(parent, {focusElement: false});
259 }
260 }
261
262 if (activeItem && activeItem !== item) {
263 this._closeItem(activeItem);
264 }
265
266 if (item.expanded()) {
267 this._clearCloseTimeout();
268 }
269
270 this._openItem(item);
271 this.listBehavior.goto(item, {focusElement: this.shouldFocus()});
272 }
273
274 /** Closes the specified menu item after a delay. */
275 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