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

Page jump to bottom on lightbox open #553

Open
BentiGorlich opened this issue Feb 12, 2025 · 4 comments
Open

Page jump to bottom on lightbox open #553

BentiGorlich opened this issue Feb 12, 2025 · 4 comments

Comments

@BentiGorlich
Copy link

BentiGorlich commented Feb 12, 2025

Describe the bug
When I click on the image that opens up the light box on mobile (Firefox) and I am at least a bit scrolled down, the page behind the lightbox jumps to the bottom.

Are you able to reproduce the bug in the demo site
No

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://gehirneimer.de on a mobile device
  2. Scroll a bit down
  3. Click on an image thumbnail
  4. Page jumps to the bottom
  5. You can also (when using remote debugging) attach an event handler to the scroll event and get this event triggered when opening the lightbox: Image

Expected behavior
The lightbox should open without the page jumping to the bottom.

Post the code you are using

const params = {
    selector: '.thumb',
    openEffect: 'none',
    closeEffect: 'none',
    touchNavigation: true,
};
GLightbox(params);

The full code can be viewed at: https://github.com/MbinOrg/mbin
The explicit js stimulus controller used: https://github.com/MbinOrg/mbin/blob/main/assets/controllers/lightbox_controller.js

Smartphone:

  • Device: Fairphone 4
  • OS: iodéOS 6 (Android 15)
  • Browser: Firefox mobile
  • Version: 135.0
@BentiGorlich
Copy link
Author

It seems like clearing the browser data and cookies solved this problem, so it had probably nothing to do with this library and was just a weird coincidence

@gingerchew
Copy link
Collaborator

That is very strange, thanks for coming back and closing this when you found the solution :)

@BentiGorlich
Copy link
Author

sure thing :)

@BentiGorlich
Copy link
Author

Ok, I am not super sure, but it is hard for me to debug, as webpack only puts the minified version in our project even when compiling it with source maps... Buuuuut I think I might have identified the problem: Only in Firefox, but emulatable on mobile: if there is a horizontally scrolling element opening the lightbox is causing a jump to the bottom of the page... I am not sure if I can reproduce it on other projects, but after searching for the origin for hours I think I can rule that out. Would you maybe try to reproduce this behaviour? Or can you give me a hint how I'd get the non minified version into webpack?

@BentiGorlich BentiGorlich reopened this Feb 18, 2025
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

No branches or pull requests

2 participants