@crowdstrike/glide-core 0.31.1 → 0.31.2
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.
- package/dist/menu.js +32 -50
- package/package.json +1 -1
package/dist/menu.js
CHANGED
@@ -571,59 +571,41 @@ let Menu = class Menu extends LitElement {
|
|
571
571
|
event.preventDefault();
|
572
572
|
}
|
573
573
|
#onDefaultSlotMouseOver(event) {
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
//
|
580
|
-
//
|
581
|
-
//
|
582
|
-
//
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
// to keep an eye on: https://issues.chromium.org/issues/364669918.
|
588
|
-
const isOutOfBounds = this.#componentElementRef.value &&
|
589
|
-
event.y < this.#componentElementRef.value.getBoundingClientRect().y;
|
590
|
-
if (!isOutOfBounds) {
|
591
|
-
const option = event.target instanceof Element &&
|
592
|
-
event.target.closest('glide-core-option');
|
593
|
-
const isSubMenuTarget = event.target instanceof Element &&
|
594
|
-
event.target.closest('[slot="target"]');
|
595
|
-
const isOwnOption = option && this.#optionElements?.includes(option);
|
596
|
-
// This handler is also called when a sub-Menu Option is hovered because sub-Menu
|
597
|
-
// Option(s) are children of their super-Menu's default slot. And hovering a
|
598
|
-
// sub-Menu Option shouldn't deactivate the super-Menu's active Option. Thus
|
599
|
-
// `isOwnOption`.
|
600
|
-
if (isOwnOption && !isSubMenuTarget && !option.disabled) {
|
601
|
-
this.#previouslyActiveOption = this.#activeOption;
|
602
|
-
if (this.#activeOption) {
|
603
|
-
this.#activeOption.privateActive = false;
|
604
|
-
}
|
605
|
-
option.privateActive = true;
|
606
|
-
if (this.#optionsElement) {
|
607
|
-
this.#optionsElement.ariaActivedescendant = event.target.id;
|
608
|
-
}
|
609
|
-
}
|
610
|
-
if (this.#isSubMenu) {
|
611
|
-
// Allowing the event to propagate from a sub-Menu's parent Option means it would
|
612
|
-
// get picked up by the super-Menu Option's Tooltip "mouseover" handler. Then it
|
613
|
-
// would open the super-Menu's tooltip.
|
614
|
-
event.stopPropagation();
|
574
|
+
const option = event.target instanceof Element &&
|
575
|
+
event.target.closest('glide-core-option');
|
576
|
+
const isSubMenuTarget = event.target instanceof Element &&
|
577
|
+
event.target.closest('[slot="target"]');
|
578
|
+
const isOwnOption = option && this.#optionElements?.includes(option);
|
579
|
+
// This handler is also called when a sub-Menu Option is hovered because sub-Menu
|
580
|
+
// Option(s) are children of their super-Menu's default slot. And hovering a
|
581
|
+
// sub-Menu Option shouldn't deactivate the super-Menu's active Option. Thus
|
582
|
+
// `isOwnOption`.
|
583
|
+
if (isOwnOption && !isSubMenuTarget && !option.disabled) {
|
584
|
+
this.#previouslyActiveOption = this.#activeOption;
|
585
|
+
if (this.#activeOption) {
|
586
|
+
this.#activeOption.privateActive = false;
|
615
587
|
}
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
//
|
620
|
-
// The Option's tooltip will pick up both events and will remain open because the
|
621
|
-
// tooltip will be closed then immediately reopened. But we want the tooltip to
|
622
|
-
// close when a sub-Menu target is hovered. Canceling the event stops the tooltip
|
623
|
-
// from reopening.
|
624
|
-
event.preventDefault();
|
588
|
+
option.privateActive = true;
|
589
|
+
if (this.#optionsElement) {
|
590
|
+
this.#optionsElement.ariaActivedescendant = event.target.id;
|
625
591
|
}
|
626
592
|
}
|
593
|
+
if (this.#isSubMenu) {
|
594
|
+
// Allowing the event to propagate from a sub-Menu's parent Option means it would
|
595
|
+
// get picked up by the super-Menu Option's Tooltip "mouseover" handler. Then it
|
596
|
+
// would open the super-Menu's tooltip.
|
597
|
+
event.stopPropagation();
|
598
|
+
}
|
599
|
+
if (isSubMenuTarget && this.#activeOption) {
|
600
|
+
// When the cursor is already inside an Option and the user mouses to the Option's
|
601
|
+
// sub-Menu target, the browser will dispatch "mouseout" followed by "mouseover".
|
602
|
+
//
|
603
|
+
// The Option's tooltip will pick up both events and will remain open because the
|
604
|
+
// tooltip will be closed then immediately reopened. But we want the tooltip to
|
605
|
+
// close when a sub-Menu target is hovered. Canceling the event stops the tooltip
|
606
|
+
// from reopening.
|
607
|
+
event.preventDefault();
|
608
|
+
}
|
627
609
|
}
|
628
610
|
#onDefaultSlotMouseUp() {
|
629
611
|
this.#isDefaultSlotClick = true;
|