Skip to content
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

Fix: page scrolls to top when opening dialog #1422

Merged
merged 3 commits into from
Jul 18, 2023
Merged

Fix: page scrolls to top when opening dialog #1422

merged 3 commits into from
Jul 18, 2023

Conversation

zenpk
Copy link
Contributor

@zenpk zenpk commented Jul 16, 2023

Fixes #1411

After some searching, I was very lucky to find the easiest solution, which is described in this comment:

PS Omitting the height: 100% effectively locks the scrolling at the current position without the jumping - on latest Chrome, at least. – zerm

https://stackoverflow.com/questions/3656592/how-to-programmatically-disable-page-scrolling-with-jquery

(I actually have no idea why it behaves like that...)

P.S. There's also a JavaScript solution but is not even close as neat: https://stackoverflow.com/questions/4770025/how-to-disable-scrolling-temporarily

@Sendouc
Copy link
Owner

Sendouc commented Jul 17, 2023

Hey! Do you get this kind of behavior on your machine as well? I see the background jumping a bit horizontally on dialog open. It's a small thing but I wonder what is causing it 🤔

Screen.Recording.2023-07-18.at.0.57.07.mov

@zenpk
Copy link
Contributor Author

zenpk commented Jul 18, 2023

@Sendouc I just tested and yes, I got the same behavior. It is caused by the absence of the scrollbar. So the "cause chain" is: overflow: hidden -> scrollbar hidden -> display moves horizontally

@Sendouc
Copy link
Owner

Sendouc commented Jul 18, 2023

Ahh ok yeah that makes sense but that's ok for now. Good work :)

@Sendouc Sendouc merged commit 12f5d37 into Sendouc:rewrite Jul 18, 2023
2 checks passed
@zenpk zenpk deleted the fix_scroll branch October 21, 2023 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Opening Dialog scrolls page to top
2 participants