Getting auto scrolled on page load
-
So whenever wp forms is active, when the page is loaded it automatically puts you at the bottom of the page. (possibly at the wp form height, (only have it at bottom of pages). This happens randomly about 50% of the times you load a page with a form on it. Confirmed it’s wp forms because it doesn’t happen when I deactivate it.
-
This topic was modified 1 week, 6 days ago by
fjallkloka.
-
This topic was modified 1 week, 6 days ago by
-
Hi @fjallkloka ,
Thanks for reaching out, and sorry to hear you’re experiencing this issue.
To help us better understand the cause and assist you further, could you please share the page URL where this is happening?
If possible, it would also be really helpful if you could share a short video or screen recording of the issue so we can see exactly what’s happening.
This will allow us to take a closer look and guide you more accurately.
Thanks! 🙂
Thank you. I can’t share a recording but the issue occurs on these 2 urls among several
https://www.fjallkloka.se/
https://www.fjallkloka.se/fjallkloka-aventyr-om-foretaget-och-om-mig/
you should only need to load them a few times in order to see whats happening, you’re placed at the bottom. Issue is both on pc and mobile.Hi @fjallkloka ,
Thanks for sharing the URLs.
I tested this on my side and was able to reproduce the issue. It looks like your theme is adding a custom inline height via CSS, which is causing the page to jump/scroll to the bottom on load.
In some cases, this height gets applied a bit late (due to caching or slower script loading), and because of that, the page ends up staying scrolled lower than expected.
Please take a look at this for reference:
Video: https://a.supportally.com/v/du3S47
Screenshot: https://a.supportally.com/i/eEhlZ4As a quick temporary fix, you can try adding this custom CSS:
@media screen and (min-width:980px){
#post-3461 .row > .col-md-8.page-content-wrap.col-md-offset-2> .wp-block-cover.alignfull.is-light {
min-height: 430px !important;
}
}This CSS is specific to this page, so it may need to be adjusted depending on the layout of other pages where you’re seeing the same issue. If you have other pages affected by the same issue, feel free to share them here. I’d be happy to help you adjust the CSS for those as well. 🙂
Also, for a more permanent fix, I’d recommend reaching out to your theme support team, as they should be able to address the delayed height/style loading directly. You can also try using or optimizing a cache plugin, which may help improve how the page loads.
Hope this helps!
Very interesting thank you, I’ll look into it. However one thing.. If it’s just about the theme shouldn’t it be an issue regardless of wpforms? The problem only occurs when wpforms plugin is active. So what you found, does that have anything related to a conflict between the theme and wpforms ?
Hi @fjallkloka ,
Thanks for your thoughtful question; you’re absolutely right to look at this closely.While the issue only appears when WPForms is active, it can still be related to a conflict between the theme and the plugin. In many cases, themes include custom scripts or styling that may not fully align with how certain plugins (like WPForms) load or function, which can lead to issues only when both are active together.
At this stage, the best next step would be to reach out to your theme’s support team first and share what you’re experiencing. They’ll be in the best position to check if anything within the theme needs adjustment to ensure compatibility.
If they confirm that something needs to be changed or addressed from the WPForms side, please don’t hesitate to let me know. I’ll be happy to pass the details along to our development team and share their feedback with you.
I’ll be here to help you through this, so feel free to keep me updated!
I tried your css code, as well as a bunch of variations of it with ai help, didn’t make a difference sad to say.
Unfortunately Hestia / Themisle support is only a premium service, and I don’t feel like paying up for this one issue.. 🙂 I’ll continue working on it and write here if I make progress.
Hi @fjallkloka ,
Thanks for the update. I dug a bit deeper into this and was able to identify what’s actually causing the behavior.
This isn’t coming from WPForms itself. There’s a custom script on your site that automatically focuses the first form field when the page loads. When a browser focuses an input field, it scrolls it into view, which is why the page jumps down to where your form is placed.
Here’s the script causing it:
jQuery(document).ready(function() { var first_input = jQuery('form.wpforms-form input[type=text]:visible:enabled:first, textarea:visible:enabled:first')[0]; if (first_input != undefined) { first_input.focus(); }});There’s also a second script that looks like an attempt to fix this by scrolling the page back to the top after a short delay:
document.addEventListener('DOMContentLoaded', function() { setTimeout(function() { if (document.activeElement && document.activeElement.tagName === 'INPUT') { document.activeElement.blur(); window.scrollTo(0, 0); } }, 50);});Because both scripts are running, they end up fighting each other, which is why the behavior feels random.
To resolve this, please remove the
first_input.focus()snippet. It’s not part of WPForms and was likely added as custom code. You can usually find it in a Code Snippets or WPCode plugin, your theme’s functions.php file, or a custom JavaScript section in your page builder.Also, to be on the safe side, please make sure to keep a backup of your site before making any changes. You can check this article to create a backup: https://www.wpbeginner.com/beginners-guide/how-to-backup-your-wordpress-site/
Once that script is removed, the second script won’t be needed either.
After making this change, the page should stop jumping to the bottom, even with WPForms active.
Hope that helps!
Ah thank you thank you. Yeah this was in a code snippet added by wpforms itself, not custom. “Focus on form”. Once deactivated, no longer an issue.
-
This reply was modified 1 week ago by
fjallkloka.
Hi @fjallkloka ,
We’re thrilled to hear your issue is resolved! Thanks for letting us know.
Your experience is important to us, and we’d love to hear what you think about using WPForms. Would you mind sharing a quick review? It only takes a minute and helps us keep improving!
Here’s the link to leave a review and in case you’d like some guidance, this article walks you through the process.
We appreciate your time and feedback!
Thanks 🙂
-
This reply was modified 1 week ago by
You must be logged in to reply to this topic.