@momentum-design/components 0.134.2 → 0.134.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,6 +13,7 @@ import { html, nothing } from 'lit';
|
|
|
13
13
|
import { property } from 'lit/decorators.js';
|
|
14
14
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
15
15
|
import { Component } from '../../models';
|
|
16
|
+
import { getHostComposePath } from '../../utils/dom';
|
|
16
17
|
import { BackdropMixin } from '../../utils/mixins/BackdropMixin';
|
|
17
18
|
import { FocusTrapMixin } from '../../utils/mixins/focus/FocusTrapMixin';
|
|
18
19
|
import { PreventScrollMixin } from '../../utils/mixins/PreventScrollMixin';
|
|
@@ -569,6 +570,16 @@ class Popover extends KeyDownHandledMixin(KeyToActionMixin(BackdropMixin(Prevent
|
|
|
569
570
|
this.handleMouseLeave = (event) => {
|
|
570
571
|
if (!this.isEventFromTrigger(event))
|
|
571
572
|
return;
|
|
573
|
+
// When the trigger contains shadow DOM children (e.g. an icon with internal SVG elements),
|
|
574
|
+
// mouseleave fires on internal elements as the mouse moves between them.
|
|
575
|
+
// Only close if the mouse has actually left the trigger element.
|
|
576
|
+
const mouseEvent = event;
|
|
577
|
+
const { triggerElement } = this;
|
|
578
|
+
if (triggerElement && mouseEvent.relatedTarget instanceof Element) {
|
|
579
|
+
if (getHostComposePath(mouseEvent.relatedTarget).includes(triggerElement)) {
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
572
583
|
this.isHovered = false;
|
|
573
584
|
this.startCloseDelay();
|
|
574
585
|
};
|