Bug: usePreventScroll is not disabled scroll behavior in ipad and iphone
- Dominant language
- TypeScript
- Stars
- 15.9k
- Forks
- 1.6k
- Avg merge
- 3d 9m
- Merged PRs (30d)
- 59
Description
### Provide a general summary of the issue here
` // Prevent scrolling the window.
if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {
e.preventDefault();
return;
}`
The issue mainly occurs in this section of the code: when I open a full-screen dialog on an iPad and use usePreventScroll({isDisable: !isOpen}), the DOM element retrieved by scrollable here is not the body—it’s the dialog instead. This causes the judgment here to fail, and scrolling cannot be disabled properly.
### 🤔 Expected Behavior?
disable scroll can be work
### 😯 Current Behavior
disable scroll can not work
### 💁 Possible Solution
_No response_
### 🔦 Context
_No response_
### 🖥️ Steps to Reproduce
when I open a full-screen dialog on an iPad and use usePreventScroll({isDisable: !isOpen}), the DOM element retrieved by scrollable here is not the body—it’s the dialog instead. This causes the judgment here to fail, and scrolling cannot be disabled properly.
### Version
latest
### What browsers are you seeing the problem on?
Safari
### If other, please specify.
_No response_
### What operating system are you using?
macos
### 🧢 Your Company/Team
_No response_
### 🕷 Tracking Issue
_No response_
Contributor guide
Research direction
Start by locating the usePreventScroll implementation and the shown scrollable check. Reproduce the full-screen dialog case in Safari on an iPad or iPhone, then trace why the dialog is returned instead of the body or document element. Done means scrolling is disabled while the dialog is open without breaking the dialog's intended behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- accessibility, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100