A bug your screen reader test will pass

In the Broken Case 1 of the Focus Not Obscured lab, keyboard focus lands on a link that sits completely under a header pinned across the top of a scroll region. That header is an absolutely positioned overlay, not position: sticky, but it behaves like a sticky header: it stays put while the content scrolls underneath. The lab's VoiceOver on Mac capture for that step (29 June 2026, taken in Arc) reads link, Chapter 3: Focus management checklist. Role and name are right. Nothing on screen shows focus.

The companion blog post explains the rule, WCAG 2.2 SC 2.4.11 Focus Not Obscured (Minimum), and which line of CSS fixes the lab. This article is about testing for it: a manual routine, a console check you can paste into DevTools, a trap I hit on the way, and the mistakes that bring the bug back.

All runs below are one browser (headless Chrome 156), one lab, one day (21 November 2026). The results are real; the conclusions are scoped to them.

What exactly to check

2.4.11 says: "When a user interface component receives keyboard focus, the component is not entirely hidden due to author-created content." Turned into checks:

  1. After every focus move, is any part of the focused component visible in the viewport?
  2. If not, what covers it, and is that content author-created (a sticky header, footer, banner, chat widget) or something the user opened and can dismiss without moving focus?
  3. Separately: is the focus indicator visible? The W3C Understanding document notes a fully obscured indicator would likely fail 2.4.7 Focus Visible too.

The criterion checks the component, not the ring. AA allows partial cover. AAA (2.4.12) allows none.

The manual routine first

Tools do not replace this:

  • Mouse away. Tab forwards through the whole page, then Shift+Tab backwards. Backwards matters: in the lab it is Shift+Tab that scrolls the region to the top and pushes the link under the header.
  • Repeat zoomed in and in a narrow window. Sticky content keeps its height while the viewport shrinks.
  • When focus seems to vanish, type document.activeElement in the Console and hover the result in the Elements panel. Chrome's highlight box shows exactly where the element is, under the header or not.

The trap: elementFromPoint says it is fine

My first idea for automating this was hit-testing: take the centre of the focused element, call document.elementFromPoint(x, y), and see whether the focused element comes back. If something covers it, the cover should come back instead.

On the broken lab case, with the link fully under the header, elementFromPoint at the link's centre returned the link itself. The header has pointer-events: none, and hit-testing skips elements with pointer-events: none. Visually the header covers the link; to the hit test, the header is not there.

That is not an exotic setup. Overlay headers, gradient fades and decorative bars often get pointer-events: none so clicks pass through them. Any check built on elementFromPoint will report those as not covering anything.

A geometry-based console check

This version ignores hit-testing and compares rectangles. On every focusin it waits two animation frames for the browser to finish scrolling, then samples a 5 by 5 grid of points inside the focused element. A point counts as visible if it is inside the viewport and every scrolling or clipping ancestor, and not inside any fixed, sticky or absolutely positioned element that is not an ancestor of the focused element.

(() => { const covers = (el) => [...document.querySelectorAll('body *')].filter((c) => { if (c === el || c.contains(el) || el.contains(c)) return false; const cs = getComputedStyle(c); if (!['fixed', 'sticky', 'absolute'].includes(cs.position)) return false; if (cs.visibility === 'hidden' || cs.display === 'none' || Number(cs.opacity) === 0) return false; const r = c.getBoundingClientRect(); return r.width > 0 && r.height > 0; }).map((c) => ({ el: c, r: c.getBoundingClientRect() })); const clips = (el) => { const out = [{ left: 0, top: 0, right: innerWidth, bottom: innerHeight }]; for (let p = el.parentElement; p; p = p.parentElement) { if (/(auto|scroll|hidden|clip)/.test(getComputedStyle(p).overflow)) { out.push(p.getBoundingClientRect()); } } return out; }; const inside = (x, y, r) => x >= r.left && x < r.right && y >= r.top && y < r.bottom; const check = (el) => { const r = el.getBoundingClientRect(); const cl = clips(el); const cv = covers(el); let visible = 0, total = 0; const hitBy = new Set(); for (let i = 0; i < 5; i++) for (let j = 0; j < 5; j++) { const x = r.left + ((i + 0.5) * r.width) / 5; const y = r.top + ((j + 0.5) * r.height) / 5; total++; if (!cl.every((c) => inside(x, y, c))) continue; const by = cv.filter((c) => inside(x, y, c.r)); if (by.length) { by.forEach((c) => hitBy.add(c.el)); continue; } visible++; } return { visible, total, hitBy: [...hitBy] }; }; document.addEventListener('focusin', () => { requestAnimationFrame(() => requestAnimationFrame(() => { const el = document.activeElement; const { visible, total, hitBy } = check(el); if (visible === 0) console.warn('Focused element entirely hidden:', el, 'covered by:', hitBy); else if (visible < total) console.info(`Partly covered (${visible}/${total} points visible):`, el, hitBy); })); }); console.log('Focus-obscured check active. Tab and Shift+Tab through the page.'); })(); 

On the lab, with the same steps (scroll to the bottom, focus Continue reading, Shift+Tab), it logged a warning for Broken Case 1 naming the header as the cover, and nothing for Fixed Case 1.

What it does not do:

  • It does not know stacking order. An absolutely positioned element painted below the focused element will be reported as a cover. Treat a warning as "go and look", not as a verdict.
  • It cannot tell author-created content from user-opened content. That is your judgement, under the criterion's Note 2.
  • It checks the component, not the focus ring, so it says nothing about 2.4.7.
  • It runs in one browser. Scroll-into-view alignment differs between browsers, which matters a lot here (see Case 2 below).

Which line actually fixes the lab

Fixed Case 1 adds scroll-padding-top on the scroll region (scroll-pt-14) and scroll-margin-top on the link (scroll-mt-14), and changes the content's top padding from pt-0 to pt-14. The lab says which one does the work: "pt-14 on the content area offsets the link below the header and is what keeps it visible in this demo." In the 21 November run, removing the padding brought the hidden link back, and removing both scroll offsets did not.

The link is the first item in the region. Shift+Tab scrolls the region to the top, and a scroll container cannot scroll above zero, so no scroll offset can move the first item down. Reserved space can. The lab calls scroll-padding-top "a complementary technique for in-page anchors further down the page". For any item the browser scrolls up to the top edge, it is exactly the right tool. For a page header, put it on the root:

/* Illustration. Match your header height, including at zoom. */ html { scroll-padding-top: 4rem; } 

Case 2: the browser decides

The lab's Case 2 is a cookie bar stuck to the bottom of a scroll region, with the Accept button just above it in the content. The lab's June capture describes the bar covering the focused button. In my 21 November headless Chrome run, even when I first scrolled so the button sat at the bottom edge behind the bar, pressing Tab scrolled the region and left the button fully visible above the bar.

How far a browser scrolls a newly focused element into view is the browser's choice. A layout that hides focus in one browser can pass in another. So test in the browsers your users have, and report what you saw, with the browser and version.

Common mistakes, and the check that catches each one

Mistake What happens Catch it with
Testing only with a screen reader VoiceOver reads the link either way Sighted keyboard pass, eyes on screen
Testing only forwards with Tab Shift+Tab is what scrolls items under a top header Tab and Shift+Tab through every page
Relying on elementFromPoint pointer-events: none overlays are invisible to hit-testing Geometry check above
Setting scroll-padding-top and stopping The first item in a container still sits under an overlay Shift+Tab to the very first focusable item
Hard-coding the header height The header grows when its text wraps (zoom, narrow widths); a fixed offset may not keep up Repeat at zoom and narrow widths
Hiding the sticky header to "fix" it Fails your design and is not required Keep it; reserve space for focus
Treating a partial cover as a pass forever AA allows it, AAA 2.4.12 does not State the level you tested to
Reporting the cookie case without checking Browser scroll alignment differs Note browser and version with the finding

What each check can establish

  • The manual routine: what a sighted keyboard user actually sees, in the browser you used.
  • The console check: a geometric warning in one browser, at one size, without stacking order.
  • A VoiceOver capture: what one screen reader said in one setup, on one date. For this criterion, it establishes nothing about visibility.

Keep practicing

Practice this in the Focus Not Obscured lab on wasexamprep.com, and read the companion post for the rule and the fix.

Watch the full walkthrough and subscribe to the A11Y in Practice YouTube channel for more hands-on accessibility episodes.

A11Y in Practice and wasexamprep.com are independent educational resources. They are not affiliated with or endorsed by IAAP (International Association of Accessibility Professionals).