@odx/foundation 1.0.0-beta.40 → 1.0.0-beta.41

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/main.js +13 -9
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -566,6 +566,8 @@ class ActiveDescendantsController {
566
566
  }
567
567
  #handleKeyboardEvent = (event) => {
568
568
  const { actions, direction } = getKeyboardEventInfo(event);
569
+ if (!direction.up && !direction.down && !actions.start && !actions.end) return;
570
+ event.preventDefault();
569
571
  if (direction.down) {
570
572
  this.next();
571
573
  } else if (direction.up) {
@@ -1536,6 +1538,7 @@ class PopoverHost extends CanBeDisabled(CustomElement) {
1536
1538
  static {
1537
1539
  this.styles = unsafeCSS(styles$1);
1538
1540
  }
1541
+ #positionUpdater;
1539
1542
  #observer;
1540
1543
  get options() {
1541
1544
  return PopoverPlacementOptions({ placement: this.placement });
@@ -1548,6 +1551,8 @@ class PopoverHost extends CanBeDisabled(CustomElement) {
1548
1551
  disconnectedCallback() {
1549
1552
  super.disconnectedCallback();
1550
1553
  this.#disconnectObserver();
1554
+ if (!this.referenceElement) return;
1555
+ this.unmountPopover(this.referenceElement);
1551
1556
  }
1552
1557
  mountPopover(referenceElement) {
1553
1558
  if (this.referenceElement && this.referenceElement !== referenceElement) {
@@ -1558,14 +1563,6 @@ class PopoverHost extends CanBeDisabled(CustomElement) {
1558
1563
  return;
1559
1564
  }
1560
1565
  this.referenceElement = referenceElement;
1561
- autoUpdate(
1562
- this.referenceElement,
1563
- this,
1564
- () => (
1565
- // biome-ignore lint/style/noNonNullAssertion: Reference element is defined when mounting popover
1566
- computePopoverPlacement(this.referenceElement, this, this.options)
1567
- )
1568
- );
1569
1566
  }
1570
1567
  unmountPopover(referenceElement) {
1571
1568
  this.hidePopover();
@@ -1574,14 +1571,21 @@ class PopoverHost extends CanBeDisabled(CustomElement) {
1574
1571
  return this.isOpen;
1575
1572
  }
1576
1573
  showPopover() {
1577
- if (this.isOpen || this.disabled || this.canPopoverShow?.() === false) return;
1574
+ if (!this.referenceElement || this.isOpen || this.disabled || this.canPopoverShow?.() === false) return;
1575
+ computePopoverPlacement(this.referenceElement, this, this.options);
1578
1576
  super.showPopover();
1579
1577
  this.isOpen = true;
1578
+ this.#positionUpdater = autoUpdate(this.referenceElement, this, () => {
1579
+ if (!this.referenceElement) return;
1580
+ computePopoverPlacement(this.referenceElement, this, this.options);
1581
+ });
1580
1582
  }
1581
1583
  hidePopover() {
1582
1584
  if (!this.isOpen || this.canPopoverHide?.() === false) return;
1583
1585
  super.hidePopover();
1584
1586
  this.isOpen = false;
1587
+ this.#positionUpdater?.();
1588
+ this.#positionUpdater = void 0;
1585
1589
  }
1586
1590
  togglePopover(state2) {
1587
1591
  const isOpen = state2 ?? !this.isPopoverOpen();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@odx/foundation",
3
3
  "description": "A library of Web Component building blocks for ODX",
4
- "version": "1.0.0-beta.40",
4
+ "version": "1.0.0-beta.41",
5
5
  "author": "Drägerwerk AG & Co.KGaA",
6
6
  "license": "SEE LICENSE IN LICENSE",
7
7
  "homepage": "https://odx.draeger.com",