Allow configuring the scroll lock target element
- Dominant language
- TypeScript
- Stars
- 10.9k
- Forks
- 543
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 101
Description
# Feature request
## Summary
Allow configuring which element gets scroll-locked when a modal popup (Dialog, Drawer, etc.) is open. Today the lock always applies to the document (`` / ``), with no way to target a different scroll container.
This could be configurable globally (once for the whole app) and/or per component (for a specific popup).
## Examples in other libraries
- usehooks-ts `useScrollLock` accepts a `lockTarget` option (an element or selector, defaulting to `document.body`): https://usehooks-ts.com/react-hook/use-scroll-lock
## Motivation
Many app layouts don't scroll the document. The page is a fixed-height shell (header, sidebar) and the main content scrolls inside a `div`. In that setup, opening a modal locks ``, which isn't scrolling, while the actual scroll container stays scrollable behind the popup.
A global setting would cover the common case of an app with a single main scroll container. A per-component option would handle exceptions, such as a popup opened from a nested scrollable panel.
Contributor guide
Research direction
Start by locating the existing scroll-lock implementation used by Dialog, Drawer, and other modal popups, then review how their component APIs and any global configuration are organized. Compare the global and per-component options described in the issue and identify the relevant tests to extend. Done means a chosen scroll container can be locked instead of document/body, with the supported configuration covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100