@corvu-next/prevent-scroll
v0.1.5
Published
SolidJS 2 utility that prevents scrolling outside of a given DOM element.
Maintainers
Readme
@corvu-next/prevent-scroll
Scroll prevention utility for SolidJS 2.0 — locks background scrolling for modals and overlays.
Note: This is the Solid 2.0 fork of solid-prevent-scroll. It targets
[email protected].
Features
- Prevents background scroll when modals/overlays are open
- Preserves scroll position
- Handles iOS Safari scroll lock
- Nestable — multiple layers can each request scroll lock
- Headless — doesn't create extra DOM elements
Installation
pnpm add @corvu-next/prevent-scrollUsage
import createPreventScroll from '@corvu-next/prevent-scroll'
createPreventScroll({ enabled: () => isModalOpen() })Further Reading
This package is part of corvu-next, a collection of unstyled, accessible and customizable UI primitives for SolidJS 2.0.
