Skip to content
easeweb
Search topics

Modals cut off at the top and bottom when zoomed in

A booking dialog centred with top: 50% and a transform has no height limit, so at 400% zoom it runs past both edges of the window, Close and Confirm included.

WCAG 2.2
SC 1.4.10AA· new in 2.1
Required by
EN 301 549 (EU)
Broken transform: translate(-50%, -50%);
The accessibility problem illustrated: Low vision:How do I confirm?
01

The problem

People who zoom in can open the booking dialog, but can't reach its Close button or Confirm booking

02

Try it

Zoom the page to 400%, then book the service

Drag the Zoom slider to 400%, then press Book a service. Can you reach the × that closes the dialog, and Confirm booking, with the mouse wheel or with Tab?

200%

Broken Can you fix this?

BrokenA dialog centred with a transform

Full service

$85

Takes about two hours. Bring the bike in the morning and collect it the same day.

What’s included

  • Brakes and gears adjusted
  • Wheels trued
  • Chain cleaned and oiled

Window: 640 by 512 CSS pixels.

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Let a tall dialog scroll inside the window

Before
BrokenA dialog centred with a transform
<button type="button" id="book">Book a service</button>…<div class="backdrop" hidden>  <div class="booking" role="dialog" aria-modal="true" aria-labelledby="booking-title">    <button type="button" class="close" aria-label="Close">×</button>    <h2 id="booking-title">Book a full service</h2>    <p>Thursday 12 November, 10:00</p>    <p>$85, paid when you collect the bike</p>    <p>Bring the bike in by 10:00. We’ll email you when it is ready, usually the same afternoon.</p>    <p>Plans change? Move or cancel the booking for free up to 24 hours before.</p>    <button type="button" class="cancel">Cancel</button>    <button type="button" class="confirm">Confirm booking</button>  </div></div>
What is wrong3 points

At 400% zoom the dialog is over 400 pixels tall, in a window 256 pixels tall.

  • The transform centres it on the window, so more than 80 pixels run past the top edge, the × and the heading with them, and as many past the bottom edge, with Cancel and Confirm booking.
  • The dialog has no max-height and no overflow, so nothing inside it scrolls.
  • It is fixed, so scrolling the page moves only the page behind it.
After

A dialog capped at the window's height

<button type="button" id="book">Book a service</button>…<div class="backdrop" hidden>  <div class="booking" role="dialog" aria-modal="true" aria-labelledby="booking-title">    <button type="button" class="close" aria-label="Close">×</button>    <h2 id="booking-title">Book a full service</h2>    <p>Thursday 12 November, 10:00</p>    <p>$85, paid when you collect the bike</p>    <p>Bring the bike in by 10:00. We’ll email you when it is ready, usually the same afternoon.</p>    <p>Plans change? Move or cancel the booking for free up to 24 hours before.</p>    <button type="button" class="cancel">Cancel</button>    <button type="button" class="confirm">Confirm booking</button>  </div></div>
How it is fixed2 steps
  1. Give the dialog max-height: calc(100dvh - 2rem). It is never taller than the window less 1rem above and below, and the transform still centres it, so it sits whole inside the window.
  2. Give it overflow-y: auto. When its content is taller than that, the dialog scrolls: the wheel, touch and the arrow keys move its content, and Tab scrolls each button into view as it takes focus.

This fixes the Before and passes 1.4.10. It is the smallest change, two lines, and the dialog looks the same wherever it fits. At 400% the × and the heading scroll away as the person reads down to the buttons, and back as they scroll up.

Easily confused
04

Verify the fix

5 checks, no mouse.

Test with: Zoom, Keyboard

0 of 5 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the dialog's component or styles change.

Limits

This is a starting pattern, not a guarantee for every application. The sizes are this example's; test your own dialogs with their longest content. A dialog that fits the window but is wider than 320 pixels, so the page scrolls sideways, is a different failure, covered in pages that scroll sideways on a narrow screen. A sticky header that hides the control in focus is covered in sticky headers and banners that hide keyboard focus. Passing at 400% doesn't make a long dialog easy to use there: a dialog that needs several screens to read may be better as a page of its own. Class names in the snippets are placeholders for your own.

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

EaseWeb service

Fixed it? Keep it from coming back.

I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.

See the service