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