@ornikar/kitt-universal 23.2.2 → 23.2.3

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.
@@ -2939,23 +2939,25 @@ function useStaticBottomSheet(Content) {
2939
2939
  }
2940
2940
 
2941
2941
  const overflowHidden = "kitt-u_overflowHidden_otm3u3";
2942
- function useBlockBodyScroll(isScrollBlocked) {
2942
+ function useBlockBodyScroll(shouldBlockScroll, isInitialRender) {
2943
2943
  useEffect(() => {
2944
- if (isScrollBlocked) {
2944
+ if (shouldBlockScroll) {
2945
2945
  document.body.classList.add(overflowHidden);
2946
- } else {
2946
+ } else if (!isInitialRender) {
2947
2947
  document.body.classList.remove(overflowHidden);
2948
2948
  }
2949
2949
  return () => {
2950
2950
  document.body.classList.remove(overflowHidden);
2951
2951
  };
2952
- }, [isScrollBlocked]);
2952
+ }, [shouldBlockScroll, isInitialRender]);
2953
2953
  }
2954
2954
  function ModalBehaviourPortal({
2955
2955
  visible,
2956
2956
  children
2957
2957
  }) {
2958
- useBlockBodyScroll(Boolean(visible));
2958
+ const isInitialRenderRef = useRef(true);
2959
+ useBlockBodyScroll(!!visible, isInitialRenderRef.current);
2960
+ isInitialRenderRef.current = false;
2959
2961
 
2960
2962
  // eslint-disable-next-line react/jsx-no-useless-fragment -- Portal propTypes define a required children, preventing a null children value
2961
2963
  return /*#__PURE__*/jsx(Portal, {