-
Notifications
You must be signed in to change notification settings - Fork 32
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
Is there a way to disable hiding of document scrollbar in the background when modal is loaded? #59
Comments
If you know a solution how to not hide the scrollbar and still avoid scrolling of the content in the background on desktop and mobile devices, then I am super happy to merge your PR or implement it. However, I don't know how to keep the scrollbar and avoid scrolling on iOS. For context see #28. |
I noticed that the linked article in #28 mentioned simply putting
on the body element. Taking a quick look at Model.svelte I don't see an equivalent (I haven't run this personally or pulled the repo so apologies if I am completely off base). Don't suppose it's that simple to avoid the (majority) of the jank??
|
I tried the following within the repl:
This resulted in the buttons retaining their exact position when tested on Firefox. Obviously in real life there is more to think about (different browsers = different scroll bar widths?) but for certain scenarios this could be a way to avoid the background moving about. (Edit: Sorry, I just realized this issue was more pertaining to the scroll bar itself hiding, but the initial posters reason for frustration was "It's kind of ugly watching the whole content behind moves to the right" - so I hope these comments are ok to stay here) |
Thanks for taking a stab at it. I believe that this works in some situations. However, the problem is that different operating systems and browsers might have different scrollbar widths. And then there are situation where the browser doesn't even display a scroll bar (like on macOS when no external mouse is connected). |
Instead of hiding the scrollbar, it may be possible to:
|
@nltesown Interesting suggestion! Do you know if this is a tested approach? I'm open to change the implementation but I want to make sure it works properly on the majority of browsers. |
@flekschas Unfortunately, I don't know. The Here's why I think this is a problem worth addressing: the projecty I'm currently working on displays a full-width calendar (7 columns, many rows), with each cell possibly having text wrapped on several lines. Therefore the disappearance of the scrollbar when the modal opens is almost certain to affect the table's layout in a very heavy and ugly way – each columns gets some extra width, allowing the cells' text content to reflow, which in turn may alter row heights... |
@nltesown I've tested the Here's an example demo: https://svelte.dev/repl/b63bc130e4474fe384373bd01391796a?version=4.0.1 Feel free to play around with the demo and let me know if I missed something. |
It's kind of ugly watching the whole content behind moves to the right because scrollbar gets hidden when modal is shown.
The text was updated successfully, but these errors were encountered: