Handles mouseout events for the menu.
(event: MouseEvent)
| 283 | |
| 284 | /** Handles mouseout events for the menu. */ |
| 285 | onMouseOut(event: MouseEvent) { |
| 286 | this._clearOpenTimeout(); |
| 287 | |
| 288 | if (this.isFocused()) { |
| 289 | return; |
| 290 | } |
| 291 | |
| 292 | const root = this.root(); |
| 293 | const parent = this.inputs.parent(); |
| 294 | const relatedTarget = event.relatedTarget as Node | null; |
| 295 | |
| 296 | if (!root || !parent || parent instanceof MenuTriggerPattern) { |
| 297 | return; |
| 298 | } |
| 299 | |
| 300 | const grandparent = parent.inputs.parent(); |
| 301 | |
| 302 | if (!grandparent || grandparent instanceof MenuBarPattern) { |
| 303 | return; |
| 304 | } |
| 305 | |
| 306 | if (!grandparent.inputs.element()?.contains(relatedTarget)) { |
| 307 | parent.close(); |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | /** Handles click events for the menu. */ |
| 312 | onClick(event: MouseEvent) { |
no test coverage detected