# willmcpo/body-scroll-lock

Body scroll locking that just works with everything 😏

Repository: https://github.com/willmcpo/body-scroll-lock
Canonical: https://ross.abutalabs.com/products/body-scroll-lock
Language: JavaScript
License: MIT
License Family: permissive
Topics: body-scroll-lock, react-scroll-lock, scroll-lock, body-scroll, react, vanilla-js, angular, modal, lightbox, ios, mobile, chrome, safari, overflow, freeze, lock, toggle, react-scrolllock, bsl, vuejs
Last push: 2023-03-30T18:49:50+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 3148, "days_push": 1252, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 4102, forks 325 (observed 2026-08-28T04:08:35.580003+00:00)

## What it is
A small JavaScript library that locks body scrolling on iOS, Android, and desktop browsers while preserving scrolling of a target element such as a modal, lightbox, or flyout. It works with vanilla JS and frameworks like React, Angular, and Vue.

## Use cases
- lock body scroll when a modal is open
- prevent background scrolling on iOS Safari
- keep modal content scrollable while freezing the page
- disable body scroll for lightbox overlays
- lock page scroll behind a mobile nav menu
- handle nested scrollable overlays
- reserve scrollbar width when locking scroll

## When to choose
- you need reliable body scroll locking on iOS mobile/tablet
- you want to keep a target element (modal, flyout) scrollable
- you use vanilla JS, React, Angular, or Vue
- you need nested target element support or scrollbar width reservation

## When to avoid
- you only target modern browsers with native overflow: clip support and want zero dependencies
- you need a maintained solution - the project is in maintenance with its latest release in 2023
- you need scroll locking for a specific framework with an official built-in solution

## Facets
- artifact type: library
- maturity: maintenance
- function: ui-components, middleware
- domain: web-development, frontend, mobile-development
- platform: browser, cross-platform
- tags: body-scroll-lock, scroll-locking, ios-safari, modal, lightbox, vanilla-js, react, vue, angular, nodejs

## Member repositories
- willmcpo/body-scroll-lock (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:35.580003+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:23:16.191751+00:00, confidence not recorded.
  - readme: https://github.com/willmcpo/body-scroll-lock (fetched 2026-08-28T04:08:35.580003+00:00, sha 7ba2800ab5b0)
  - registry_npm: https://registry.npmjs.org/body-scroll-lock (fetched 2026-08-29T09:15:04.431250+00:00, sha 63d674b117ab)
- Data as of 2026-08-30T08:39:29.467469+00:00.
