werkbank
    Preparing search index...

    Function usePreventScroll

    • Prevents scrolling on the document body.

      Parameters

      • prevent: boolean = true

        Whether to prevent scrolling (default: true).

      Returns void

      This hook sets overflow: hidden on the document body when active. It also compensates for the scrollbar width to prevent layout shifts.

      usePreventScroll(isModalOpen);