analytica-frontend-lib 1.1.87 → 1.1.88

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.
@@ -1730,14 +1730,34 @@ var Modal = ({
1730
1730
  return () => document.removeEventListener("keydown", handleEscape);
1731
1731
  }, [isOpen, closeOnEscape, onClose]);
1732
1732
  (0, import_react5.useEffect)(() => {
1733
+ if (!isOpen) return;
1734
+ const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
1733
1735
  const originalOverflow = document.body.style.overflow;
1734
- if (isOpen) {
1735
- document.body.style.overflow = "hidden";
1736
- } else {
1737
- document.body.style.overflow = originalOverflow;
1736
+ const originalPaddingRight = document.body.style.paddingRight;
1737
+ document.body.style.overflow = "hidden";
1738
+ if (scrollbarWidth > 0) {
1739
+ document.body.style.paddingRight = `${scrollbarWidth}px`;
1740
+ const overlay = document.createElement("div");
1741
+ overlay.id = "modal-scrollbar-overlay";
1742
+ overlay.style.cssText = `
1743
+ position: fixed;
1744
+ top: 0;
1745
+ right: 0;
1746
+ width: ${scrollbarWidth}px;
1747
+ height: 100vh;
1748
+ background-color: rgb(0 0 0 / 0.6);
1749
+ z-index: 40;
1750
+ pointer-events: none;
1751
+ `;
1752
+ document.body.appendChild(overlay);
1738
1753
  }
1739
1754
  return () => {
1740
1755
  document.body.style.overflow = originalOverflow;
1756
+ document.body.style.paddingRight = originalPaddingRight;
1757
+ const overlay = document.getElementById("modal-scrollbar-overlay");
1758
+ if (overlay) {
1759
+ overlay.remove();
1760
+ }
1741
1761
  };
1742
1762
  }, [isOpen]);
1743
1763
  if (!isOpen) return null;