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

Method onMouseOver

src/aria/private/menu/menu.ts:227–260  ·  view source on GitHub ↗

Handles mouseover events for the menu.

(event: MouseEvent)

Source from the content-addressed store, hash-verified

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