analytica-frontend-lib 1.1.86 → 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.
@@ -1706,14 +1706,34 @@ var Modal = ({
1706
1706
  return () => document.removeEventListener("keydown", handleEscape);
1707
1707
  }, [isOpen, closeOnEscape, onClose]);
1708
1708
  useEffect3(() => {
1709
+ if (!isOpen) return;
1710
+ const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
1709
1711
  const originalOverflow = document.body.style.overflow;
1710
- if (isOpen) {
1711
- document.body.style.overflow = "hidden";
1712
- } else {
1713
- document.body.style.overflow = originalOverflow;
1712
+ const originalPaddingRight = document.body.style.paddingRight;
1713
+ document.body.style.overflow = "hidden";
1714
+ if (scrollbarWidth > 0) {
1715
+ document.body.style.paddingRight = `${scrollbarWidth}px`;
1716
+ const overlay = document.createElement("div");
1717
+ overlay.id = "modal-scrollbar-overlay";
1718
+ overlay.style.cssText = `
1719
+ position: fixed;
1720
+ top: 0;
1721
+ right: 0;
1722
+ width: ${scrollbarWidth}px;
1723
+ height: 100vh;
1724
+ background-color: rgb(0 0 0 / 0.6);
1725
+ z-index: 40;
1726
+ pointer-events: none;
1727
+ `;
1728
+ document.body.appendChild(overlay);
1714
1729
  }
1715
1730
  return () => {
1716
1731
  document.body.style.overflow = originalOverflow;
1732
+ document.body.style.paddingRight = originalPaddingRight;
1733
+ const overlay = document.getElementById("modal-scrollbar-overlay");
1734
+ if (overlay) {
1735
+ overlay.remove();
1736
+ }
1717
1737
  };
1718
1738
  }, [isOpen]);
1719
1739
  if (!isOpen) return null;