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

Bug: Page jumps when hcaptcha-image-select-dialogue shows #151

Open
davidfaber opened this issue Aug 9, 2022 · 9 comments
Open

Bug: Page jumps when hcaptcha-image-select-dialogue shows #151

davidfaber opened this issue Aug 9, 2022 · 9 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@davidfaber
Copy link

I'm using react-hcaptcha with GatsbyJS. Whenever the hcaptcha opens the page jumps to top and the dialogue shows centered on the screen (not next to the button).

I simply can't figure out why.

If you need anything, please let me know.

Thanks in advance,
David

@cryptoroland

This comment was marked as spam.

@e271828-
Copy link
Contributor

@davidfaber do you have an example site or minimal repro of this?

@cryptoroland

This comment was marked as spam.

@cryptoroland

This comment was marked as spam.

@cryptoroland

This comment was marked as spam.

@e271828- e271828- added bug Something isn't working question Further information is requested labels Aug 12, 2022
@davidfaber
Copy link
Author

Hi @e271828-,
Thanks for the quick reply.

Yes... I do have an example. If you go to https://oe44.gtsb.io/kontakt/ (PW is oe44, no worries it's just so Google doesn't index the staging-site).

At the bottom of the page you'll find a contact-form. Fill out all the fields including the checkbox at the end and hit send. You should then see 2 things:

  • the hCaptcha
  • the page scrolled to the top

Thanks in advance,
David

@zoryana94
Copy link
Contributor

Hi @davidfaber,

Thank you for providing an example!
Unfortunately, I still couldn't reproduce the issue. Which platform/browser do you use?

Also, I suspect it might be the form itself that causes the issue. Please check this: https://stackoverflow.com/questions/30960537/submit-button-in-bootstrap-scrolling-to-top

Please let us know the additional details or if the issue gets fixed.

Best Regards,
IMI Dev Team

@awesomephant
Copy link

awesomephant commented Jan 16, 2023

I think I've run into the same issue as OP.

Test: Codepen
Browser: Windows / Firefox 108 (64-bit):

Steps:

  • Scroll down to the bottom of the page
  • Tap the hCaptcha widget to trigger the challenge modal
  • Tap outside the modal to close it
  • Tap the widget again

Expected:

  • Challenge modal opens and closes right next to the widget
  • Scroll position stays the same

Actual:

  • The first time you open the modal, the page jerks a little bit. On subsequent invocations, the page scrolls all the way to the top.

Behaviour in Chrome is as expected.


OP also describes an issue where the modal appears in the centre of the screen rather than next to the widget. I'm seeing the same issue in Firefox and Chrome, but I think it's separate from the first issue. Maybe it's related to the fact that the modal HTML is injected right before the closing </body> tag, outside of Gatsby's page container (div#___gatsby)? Edit: I've looked into it a little more and it looks like the modal is centred on the screen whenever the widget container is set to position:absolute or fixed - I take it that's intended behaviour?

@zoryana94
Copy link
Contributor

Hi @awesomephant!

Thank you for notifying us about the issue!
And thank you a lot for providing us with the investigation details and the test app for reproducing it!

We'll look into it and let you know the summary of our investigation.

Best Regards,
IMI Dev Team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants