- Docs
- Changelog
Changelog
Every @samline/scroll-lock release, newest first, with breaking changes, behavior changes and upgrade steps called out explicitly.
All notable changes to this package. Format: Keep a Changelog; versions follow semver.
[1.0.0] - 2026-11-18
Added
- First release, the successor of the archived
disable-scroll.js. The engine comes from@samline/drawer6.0.1. lockScroll(options)locks the page and returns an idempotent release. Locks nest: the page unlocks after the last release, in any order.createScrollLock(options)returns{ lock, unlock, toggle, isLocked, destroy }, one lock per component.scrollLock(target, options)locks while an element is open (openon<dialog>and<details>,:popover-openon popovers, nohiddenoraria-hidden="true"otherwise, or a customisOpen), and returns{ refresh, isLocked, destroy }.autoScrollLock(options)watches every[data-scroll-lock], including elements added later.isScrollLocked()andresetScrollLock().- Options
mode(auto,overflow,ios),reserveGapandpositionFixed(never,safari,always), and the attributesdata-scroll-lock-mode,data-scroll-lock-gapanddata-scroll-lock-position-fixed.data-scroll-lock="false"turns an element off. data-scroll-lock-stateon<html>(locked) and on watched elements (lockedorunlocked), and the--scroll-lock-gapcustom property.- The Mobile Safari workaround and the
position: fixedbody pin, adapted from vaul (MIT) and React Spectrum (Apache-2.0); their notices are inLICENSE.md. window.ScrollLockbrowser global withlock(),unlock(),auto()anddata-manual.