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.
package/dist/index.mjs CHANGED
@@ -1924,14 +1924,34 @@ var Modal = ({
1924
1924
  return () => document.removeEventListener("keydown", handleEscape);
1925
1925
  }, [isOpen, closeOnEscape, onClose]);
1926
1926
  useEffect3(() => {
1927
+ if (!isOpen) return;
1928
+ const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
1927
1929
  const originalOverflow = document.body.style.overflow;
1928
- if (isOpen) {
1929
- document.body.style.overflow = "hidden";
1930
- } else {
1931
- document.body.style.overflow = originalOverflow;
1930
+ const originalPaddingRight = document.body.style.paddingRight;
1931
+ document.body.style.overflow = "hidden";
1932
+ if (scrollbarWidth > 0) {
1933
+ document.body.style.paddingRight = `${scrollbarWidth}px`;
1934
+ const overlay = document.createElement("div");
1935
+ overlay.id = "modal-scrollbar-overlay";
1936
+ overlay.style.cssText = `
1937
+ position: fixed;
1938
+ top: 0;
1939
+ right: 0;
1940
+ width: ${scrollbarWidth}px;
1941
+ height: 100vh;
1942
+ background-color: rgb(0 0 0 / 0.6);
1943
+ z-index: 40;
1944
+ pointer-events: none;
1945
+ `;
1946
+ document.body.appendChild(overlay);
1932
1947
  }
1933
1948
  return () => {
1934
1949
  document.body.style.overflow = originalOverflow;
1950
+ document.body.style.paddingRight = originalPaddingRight;
1951
+ const overlay = document.getElementById("modal-scrollbar-overlay");
1952
+ if (overlay) {
1953
+ overlay.remove();
1954
+ }
1935
1955
  };
1936
1956
  }, [isOpen]);
1937
1957
  if (!isOpen) return null;