-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dialog Scrollbar doesn't work properly on Mobile Devices #2259
Comments
@RobinMalfait the repository was updated. Thank you. |
@jagustin I can't seem to reproduce this (I'm iPhone 14 Pro Max, iOS 16.3). Can you try and clear your node_modules and your rm -rf ./node_modules .next
npm install
npm run dev This is a bug we used to have in Headless UI, but that should have been solved already, my guess/hope is that you have a bogus build and some old version of Headless UI despite installing the latest version. |
@RobinMalfait I just removed the cache and install everything. The issue continue To replicate as soon as the dialog is opened, you could scroll up and down very close to end of the screen (left side). It looks like the overlay doesn't cover all the screen and the gesture take the body scroll. |
@jagustin it took a while, but I can reproduce it now. Will have a look and keep you posted. |
Hey! Is there a solution to this? Thanks |
Facing the same issues with Chrome on iPhone 6 and iPhone 14 iOS 15. Maybe a regression? |
I find out the problem is that body is still scrollable when dialog appeared in iOS safari(webkit based browser). Here's my solution, just make body not scrollable after dialog appeared, also set const makeBodyNotScrollable = () => {
document.body.style.height = `calc(100vh - ${document.body.style.marginTop})`;
document.body.style.overflowY = 'hidden';
}
return (
<Transition appear show={visible} afterEnter={makeBodyNotScrollable}>
<Dialog>
</Dialog>
</Transition>
) Hope this helps. |
Hi guys, i have same issues with browsers on ios 14, dialog can not show. |
Hey! I believe this is solved now if you use the latest
This |
Any solution to this problem? facing the same issue |
Hey! I'm still experiencing this issue with browsers on iOS.I use nexjs 14 and headless ^2.0.0-alpha.4, I tried installing @headlessui/react@next and used the makeBodyNotScrollable function that you suggested above, but the scrollbar in the dialog still doesn't work. When we click on any element on the modal, a touch-action: none style is applied to that element, which I think is the reason for not being able to scroll on mobile iOS. Thank you! |
how do we prevent touch-action from applying to element that it shouldn't even apply to? Depending on how you scroll on a mobile phone while simultaneously opening a component (drawer) will somehow add touch-action:none style to any element that you touch. Update:
and adding these styles to override touch-action:none that headless-ui keeps applying to these elements.
|
What package within Headless UI are you using?
@headlessui/react
What version of that package are you using?
1.7.10
What browser are you using?
Chrome and Safari on iPhone 13 Pro
Reproduction URL
Repo
https://github.com/jagustin/modal-tailwind-test
Instructions:
Scroll down until the button "Open Dialog" and tap it. When the Dialog is opened scroll up and down on the left of the screen you will notice that the body will scroll (The Dialog don't need to scroll, the content is not enough to cover the screen but the scrollbar appear..)
Video
https://drive.google.com/file/d/1FV-TcZK_ZxtYEsDIjaBorD-1QeNip31b/view?usp=share_link
Describe your issue
When the Dialog Modal is opened and the body has been scrolled before, the scroll event works for the body scroll but not for the Dialog Modal. That only happens on mobile devices. I am including a repo and video to help you understand the issue.
The text was updated successfully, but these errors were encountered: