Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Focused element hidden behind sticky header: how to fix it

PRF-316Medium impactOther toolBy FunnelGuardPublished Updated
On this page

What this issue is

A sticky (or fixed) element stays on screen while the page scrolls. Common examples are a top navigation bar, a promo banner, a cookie notice and a floating chat or checkout bar. When someone moves through your page with the Tab key, the browser scrolls the focused control into view. It does not know about your sticky bar, so the control can land underneath it.

How a keyboard user loses their place
  1. Tab to next fieldFocus moves up the form as the user tabs backwards or forwards
  2. Browser scrollsIt scrolls the field just to the viewport edge
  3. Header covers fieldSticky header sits over the focused input
  4. User types blindNo visible cursor or focus ring
  5. Form abandonedErrors or wrong entries go unnoticed

The focus moves on, but the field sits under the header, so the user cannot see what they are typing into.

Why it costs you leads or sales

People who navigate by keyboard include screen magnifier users, people with motor impairments and power users who simply prefer Tab. If they cannot see the focused field, they mistype, skip required fields or give up on the form or checkout. The same happens to anyone on a short laptop screen or a zoomed browser, where a tall sticky header takes up much of the viewport.

Visible form area as header height growsExample numbers
Visible form area as header height grows (example)No sticky bar: 100 % of viewport left; 80px header: 89 % of viewport left; 80px header + 60px cookie bar: 80 % of viewport left; 120px header + 100px banner: 69 % of viewport left03877100898069No sticky bar80px header80px header + 60px co…120px header + 100px …% of viewport left

Example: on a 700px-high window (zoomed or small laptop), the taller the sticky bars, the less room is left for the focused field.

How to check if your site has it

Manual keyboard test (5 minutes)
  1. Open a long page with a form

    Use your contact, checkout or booking page. Scroll to the top.

  2. Tab forwards through every control

    Watch whether each focused link, field and button stays visible below the sticky header.

  3. Tab backwards with Shift+Tab

    Moving up the page is where fields most often slide under a top header.

  4. Repeat at 200% zoom and on a small window

    Sticky bars take up more of the screen, which exposes the problem faster.

  5. Test with banners open

    Leave the cookie notice, promo bar and chat widget showing, since they also cover focus.

How to fix it

The cleanest fix is CSS. scroll-padding-top on the html element tells the browser to leave that much space at the top when it scrolls something into view, including for focus. scroll-margin-top does the same for a single element.

Reserve space for a sticky headercss
:root {
  --header-height: 88px; /* match your real header height */
}

html {
  scroll-padding-top: calc(var(--header-height) + 16px);
}

/* Optional: per element */
input, select, textarea, button, a, [tabindex] {
  scroll-margin-top: calc(var(--header-height) + 16px);
}
Where to add it on each platform
  1. Open custom CSS

    Go to Appearance > Customize > Additional CSS (or Appearance > Editor > Styles > Additional CSS in block themes).

  2. Paste the snippet

    Set --header-height to your theme's sticky header height. If the header height changes on mobile, add a media query.

Keep padding in sync with sticky bars that change sizejavascript
function updateScrollPadding() {
  const bars = document.querySelectorAll('[data-sticky]');
  let total = 0;
  bars.forEach((el) => { total += el.getBoundingClientRect().height; });
  document.documentElement.style.scrollPaddingTop = (total + 16) + 'px';
}
window.addEventListener('load', updateScrollPadding);
window.addEventListener('resize', updateScrollPadding);

How to confirm it's fixed

Re-test checklist
  • Tab and Shift+Tab through the whole form: every focused control is visible below the header.
  • Test at 200% zoom and in a short browser window.
  • Test with the cookie banner, promo bar and chat widget open.
  • Check bottom sticky bars too, such as a mobile add-to-cart bar.
  • Test on mobile with an external keyboard if your audience uses one.
  • Check the published site, not just the editor preview.

How to prevent it happening again

Sticky header handling

Before

  • Header height hard-coded nowhere
  • Focused fields slide under the bar
  • New banners added without a keyboard test

After

  • scroll-padding-top matches header height
  • Focused fields stay in view
  • Keyboard pass is part of every design change

Whenever you change the header, add a banner or install a chat widget, repeat the Tab test. Add an accessibility scan and a keyboard pass to your release checklist so it is not left to chance.

How FunnelGuard handles this

This issue is outside what FunnelGuard checks. FunnelGuard runs your customer journeys on a schedule and watches steps, tracking hits and test leads, but it does not judge how a page looks to a keyboard user. The kind of tool that fits is an accessibility testing tool: a browser extension or automated scanner for WCAG issues, combined with a manual keyboard and screen magnifier test like the one above.

Where FunnelGuard can help is the neighbouring risk: after a header or banner change, it can confirm that your form still submits and your test lead still arrives. You can start with the Free plan (1 site, 2 journeys, daily checks, no card).

Questions people ask

Why is my form field hidden behind the sticky header when I press Tab?

The browser scrolls the focused field to the edge of the viewport and does not account for fixed or sticky elements. The header then sits on top of it. Setting scroll-padding-top on the html element to the header height fixes this in modern browsers.

What is WCAG 2.4.11 Focus Not Obscured?

It is a WCAG 2.2 level AA criterion. It requires that when an element receives keyboard focus, it is not entirely hidden by content you author, such as sticky headers, cookie banners or chat widgets. Partly hidden still passes at this minimum level.

How do I stop a sticky header covering focused elements with CSS?

Add html { scroll-padding-top: 100px; }, using a value slightly larger than your header height. You can also set scroll-margin-top on individual elements. Both tell the browser to leave space when scrolling focus into view.

Does a cookie banner or chat widget count as obscuring focus?

Yes. Any author-created content that overlays the focused element can fail 2.4.11, including bottom cookie bars, floating chat buttons and sticky add-to-cart bars. Test with them open.

Is partly covered focus a WCAG failure?

Not at the minimum level 2.4.11, which fails only when the focused element is entirely hidden. The stricter AAA criterion 2.4.12 requires that no part is hidden, so aim for fully visible.

How do I test if focus is hidden by a sticky header?

Open a long page, press Tab and Shift+Tab through every control and watch whether each one stays visible. Repeat at 200% zoom and with banners open. An automated scanner cannot reliably catch this, so a manual pass is needed.

Can FunnelGuard detect focus hidden behind a sticky header?

No. This needs an accessibility testing tool and a manual keyboard check. FunnelGuard checks that your funnel steps, tracking and lead delivery work, which is a different job.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.