@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.
Files changed (2) hide show
  1. package/dist/menu.js +32 -50
  2. 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
- // Chrome has this funky Popover API bug where the popover is, for about 10
575
- // milliseconds, rendered above where it's supposed to be whenever `showPopover()`
576
- // is called.
577
- //
578
- // It's not clear if the popover is invisible during that time, or if it's visible
579
- // and 10 milliseconds isn't enough to be noticable. Either way, it's effectively
580
- // invisible but still picks up "mouseover" events.
581
- //
582
- // If the user's mouse happens to be over one of the Option(s) that's inside our
583
- // invisible, mispositioned popover, then the Option is activated. Thus this
584
- // variable and the guard below it.
585
- //
586
- // There's no mention of the above issue in it. But this bug is probably a good one
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
- if (isSubMenuTarget && this.#activeOption) {
617
- // When the cursor is already inside an Option and the user mouses to the Option's
618
- // sub-Menu target, the browser will dispatch "mouseout" followed by "mouseover".
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdstrike/glide-core",
3
- "version": "0.31.1",
3
+ "version": "0.31.2",
4
4
  "description": "A Web Component design system",
5
5
  "author": "CrowdStrike UX Team",
6
6
  "license": "Apache-2.0",