Sub topic 13
Visible focus, text zoom and reduced motion
This chapter covers three checks that a pixel comparison with the design cannot catch. They test how the page behaves when a user changes how they interact with it: moving by keyboard, enlarging text, or asking for less animation. It assumes you can open DevTools, read computed styles, and have done the earlier checks on layout, typography and color.
Why a design comparison misses these
A design file usually shows one state at one size with the mouse idle. Focus rings, enlarged text and reduced-motion variants are often missing from it. The comparison against the design therefore passes while the page still fails real users. Treat the design as the reference for what is drawn. Treat the checks below as tests of what the page does under changed conditions.
The relevant WCAG (Web Content Accessibility Guidelines) criteria are:
| Check | Criterion | Level |
|---|---|---|
| Focus indicator exists | 2.4.7 Focus Visible | AA |
| Focus is not hidden by other content | 2.4.11 Focus Not Obscured (Minimum), WCAG 2.2 | AA |
| Focus indicator contrast | 1.4.11 Non-text Contrast (3:1) | AA |
| Text resizes to 200% | 1.4.4 Resize Text | AA |
| Content reflows at 320 CSS px wide | 1.4.10 Reflow | AA |
| Text spacing can be overridden | 1.4.12 Text Spacing | AA |
| Long-running motion can be stopped | 2.2.2 Pause, Stop, Hide | A |
| Motion triggered by interaction can be disabled | 2.3.3 Animation from Interactions | AAA |
Visible focus
Put the mouse aside and press Tab from the top of the page. For every stop, check four things:
- You can see where focus is.
- The indicator has at least 3:1 contrast against the colors next to it.
- Nothing clips the indicator, and nothing covers the focused element, such as a sticky header or cookie banner.
- The order matches the visual reading order.
Common defects:
- A reset stylesheet sets
outline: noneand nothing replaces it. - A parent with
overflow: hiddencuts off an outline drawn outside the element's box. - A light ring on a white section, or a dark ring on a dark footer.
- Custom controls built from
divelements that never receive focus.
Use :focus-visible instead of :focus. Browsers apply it for keyboard focus and usually not for mouse clicks, so designers get fewer complaints about rings on buttons.
:focus-visible {
outline: 3px solid #1a4fd6;
outline-offset: 2px;
}
.on-dark :focus-visible {
outline-color: #ffffff;
}
.card-list {
/* Give the ring room so a clipping parent does not hide it */
padding: 4px;
}In DevTools you can force a state without tabbing. In the Elements panel, open the :hov toggle in the Styles pane and tick :focus-visible. To see what is focused as you tab, paste this into the console:
document.addEventListener('focusin', (event) => {
const el = event.target;
const s = getComputedStyle(el);
console.log(el.tagName, el.className, {
outlineStyle: s.outlineStyle,
outlineWidth: s.outlineWidth,
outlineColor: s.outlineColor,
boxShadow: s.boxShadow
});
});Be aware that this logs the styles at focus time, so a rule that only applies on :focus-visible shows up only if the focus came from the keyboard. If outlineStyle is none and boxShadow is also none, the element has no indicator. Check the ring's contrast with the contrastRatio function from the color chapter.
Text zoom and resizing
Browsers offer two different ways to enlarge text, and they fail in different ways.
- Page zoom (Ctrl or Cmd with
+) scales everything, so the viewport in CSS pixels gets narrower. At 400% on a 1280px window, the layout behaves like a 320px-wide screen, which is how you test 1.4.10 Reflow. You should not need to scroll in two directions, except for content like data tables or maps. - Text-only enlargement changes the browser's default font size in settings (in Chrome, Appearance, Font size, "Very large"). This only affects text sized relative to the root, such as
remandem. Anything inpxstays the same, which is a defect for body text.
The usual faults found by these tests are fixed heights, px font sizes, and absolutely positioned labels that collide when text grows:
/* Fails: text overflows the fixed box and the px size ignores the browser setting */
.banner {
height: 48px;
font-size: 14px;
}
/* Passes: size follows user settings and the box grows with its content */
.banner {
min-height: 3rem;
padding: 0.5rem 1rem;
font-size: 0.875rem;
line-height: 1.5;
}Test at 200% and 400% zoom, then again with the browser default font size set to large. At each level, look for clipped or overlapping text, buttons whose labels spill out, a header that fills the whole viewport so content never appears, and navigation that stops working. Check that the hamburger menu appears at narrow effective widths.
You should also test text spacing (1.4.12). Users may apply their own spacing, and your page must not lose content when they do. Run this in the console, then scan for clipped text:
const style = document.createElement('style');
style.textContent = `
* {
line-height: 1.5 !important;
letter-spacing: 0.12em !important;
word-spacing: 0.16em !important;
}
p {
margin-bottom: 2em !important;
}
`;
document.head.appendChild(style);These values are the WCAG test values: line height 1.5 times the font size, paragraph spacing 2 times, letter spacing 0.12 em, and word spacing 0.16 em.
Reduced motion
Some users get dizzy or sick from parallax, large slides, or auto-scrolling. Operating systems let them request less motion, and browsers expose that as the prefers-reduced-motion media query. "Reduce" does not mean "remove everything". Fades and color changes are usually fine. Remove large movement, zoom effects, and looping animation.
@keyframes slide-in {
from { transform: translateY(40px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
html {
scroll-behavior: smooth;
}
.hero {
animation: slide-in 600ms ease-out;
}
@media (prefers-reduced-motion: reduce) {
html {
scroll-behavior: auto;
}
.hero {
animation: none;
}
}To test without changing your system setting, open DevTools, press Cmd/Ctrl+Shift+P, run "Show Rendering", and set "Emulate CSS media feature prefers-reduced-motion" to reduce. Reload and compare. Look at hero entrances, carousels that advance on their own, parallax backgrounds, smooth scrolling, and videos that autoplay. Scripts that start animation also need to respect the setting:
const query = window.matchMedia('(prefers-reduced-motion: reduce)');
console.log('Reduced motion requested:', query.matches);
query.addEventListener('change', (event) => {
console.log('Preference changed:', event.matches);
});Moving content that starts automatically and lasts over five seconds, such as a carousel, needs a visible pause control regardless of this setting (2.2.2).
Recording the findings
Log each failure with the setting that exposed it, as in "Nav links overlap at 200% zoom, 1280px window, Chrome". That wording lets a developer reproduce it exactly. Severity guidance comes in the triage chapter. As a rule of thumb, a missing focus indicator on a primary action is a blocker, while a slightly low-contrast ring is minor.
Exercise
A page has button:focus { outline: none; } and a :focus-visible rule that adds a 2px light-gray ring. The page background is white. Name two problems you would report, and one change to fix them.
Show answer
First, the gray ring on white almost certainly fails the 3:1 contrast requirement (1.4.11), so the indicator is hard to see. Second, the outline: none on :focus removes the default indicator for any case where :focus-visible does not match, for example in older browsers. Remove the outline: none rule and use a dark, high-contrast ring such as outline: 3px solid #1a4fd6; outline-offset: 2px; on :focus-visible.
Exercise
At 200% page zoom a promo banner is fine, but when you set the browser's default font size to "Very large" its text is cut off. What is the likely cause, and how would you fix it?
Show answer
The banner likely has a fixed height in px, or a px font size mixed with a rem-based container, so the box cannot grow when the text does. Replace the fixed height with min-height in rem, add padding, use rem for the font size, and set a unitless line-height such as 1.5.
Exercise
You enable "prefers-reduced-motion: reduce" emulation, and the hero still slides in. Where in the code would you look, and what two things might you find?
Show answer
Look for the animation CSS and any JavaScript that starts it. You might find that the @media (prefers-reduced-motion: reduce) block does not target the right selector, or that a script (such as a carousel or scroll library) starts the animation without checking window.matchMedia('(prefers-reduced-motion: reduce)').