Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Home page jumps to modular page on desktop browsers

Solved by Vadym View solution

Started by Gravver 2 days ago · 6 replies · 97 views
2 days ago

Hi all,

My site uses the Quark Theme with Grav version 2.1.12.

I am experiencing an issue on desktop browsers where the home page automatically scrolls down to a specific modular section upon loading, rather than staying at the top of the page.

Interestingly, this issue only occurs on desktop browsers—where modular sub-pages are linked directly in the top navigation bar. On mobile, which uses a collapsible hamburger menu containing only parent pages, the page loads normally at the top.

A few key details:

  • The URL does not contain an anchor/hash tag (e.g. #section-name).

  • Clicking the site logo reloads the page, but it immediately scrolls back down to the modular section.

  • On a large desktop monitor, it jumps to one specific modular section, whilst on a MacBook Air, it jumps to a different modular section (though consistent per device/screen size).

  • Cloudflare Rocket Loader is disabled, and caches have been cleared.

  • I tried deleting and recreating the target modular page, but the behaviour persists.

I came across suggestions mentioning autofocus, but I am not familiar with where to find or disable this setting in Admin > Pages.

1 day ago

Do you have a link to the actual site in question?

1 day ago

https://eposrentalglasgow.com

1 day ago

Thanks for the suggestion, @Vadym.

I tried setting autofocus: false on all modular pages, but unfortunately, it made no difference.

I suspect the issue might stem from a workaround I implemented a while ago, where I modified the navigation bar to display anchor links to modular sections instead of standard page links. I’ll review that setup to see if I can reverse it. If that doesn't resolve it, I may just set up a fresh installation with a default navigation bar and migrate the content over.

1 day ago Solution

It seems there was a slight mix-up regarding where the autofocus parameter is applied. autofocus is a field-level setting (under form.fields), not a page-level header option.

  1. Open the page/module where your contact form is defined (switch to Expert Mode in the Grav Admin panel or edit the .md file directly).

  2. Look inside the form.fields section for your input fields ( name field):

YAML
form:
  fields:
    - name: name
      label: Name
      placeholder: 'Enter your name'
      autofocus: 'on'  # <-- REMOVE this line or set to false
      type: text
  1. Delete the autofocus: 'on' (or true) line from that field, or set it to autofocus: false directly under that specific field item.

Adding autofocus: false at the root level of the page header won't override it.

Once removed, the generated HTML <input> will no longer contain autofocus="autofocus", and the browser will stop jumping to the form on page load.

❤️ 1
16 hours ago

That’s outstanding, thank you. That seems to have completely resolved the issue.

Suggested topics

Topic Participants Replies Views Activity
Support · by Marcel, 2 weeks ago
2 195 17 hours ago
Support · by blu3prince, 1 week ago
1 123 4 days ago
Support · by complanar, 1 week ago
6 203 5 days ago
Support · by Rick Beebe, 1 week ago
2 158 7 days ago
Support · by alex, 1 week ago
2 146 1 week ago