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

Opening modal scrolls user to bottom of page #22

Open
kangabell opened this issue Feb 3, 2022 · 2 comments
Open

Opening modal scrolls user to bottom of page #22

kangabell opened this issue Feb 3, 2022 · 2 comments

Comments

@kangabell
Copy link

When I click to open the modal, it initially appears as expected, but after a brief delay (less than a second) I am scrolled to the bottom of the page. I've tried adding the modal as a menu item and also as a Gutenberg block, but both give the same result. The issue is not present when added as a shortcode with the "type" set to "button".

This occurs with no customization to the plugin, all other plugins deactivated, and tested with both my own custom theme and with the "Twenty Twenty-One" theme.

@kangabell
Copy link
Author

I think the issue has to do with the fact that the <a> versions of the trigger have an href that points to the modal div, which is at the bottom of the page in the DOM, while the <button> versions don't have an href.

Adding something like this to my js seems to fix the issue:

$('[data-searchwp-modal-trigger]').click( function() {
	return false;
})

@verstecken
Copy link

I am having the same issue. Don´t know how to fix it without JQuery. Would you help me, @kangabell ?

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