Skip to content
easeweb
Search topics

Floating buy bars that cover the page when zoomed in

A floating Add to bag bar keeps room for one row, but at 400% zoom it wraps onto two, covers nearly half the window and hides the page's last link.

WCAG 2.2
SC 1.4.10AA· new in 2.1SC 2.4.11AA· new in 2.2
Required by
EN 301 549 (EU)
Broken flex-wrap: wrap;
The accessibility problem illustrated: Low vision:What's under the bar?
01

The problem

People who zoom in can't read the end of the page, and keyboard users among them lose focus under a floating bar that covers nearly half the window

02

Try it

Zoom the page to 400%, then read it to the end

Drag the Zoom slider to 400%, then scroll the shop’s page to the bottom, or Tab to its last links. Can you read Contact us?

Simulate
200%

Broken Can you fix this?

BrokenA bar that wraps, and space kept for one row

Linen overshirt

$48

Colour: Sand

Washed linen, soft from the first wear. Wear it open over a T-shirt, or buttoned up on its own.

  • 100% linen
  • Machine wash at 30°C
  • Relaxed fit

Linen overshirt

$48

Window: 640 by 512 CSS pixels.

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Keep the bar from covering the page at any zoom

Before
BrokenA bar that wraps, and space kept for one row
:root {  /* The bar as drawn: 4rem tall, 1rem above the bottom edge. */  --bar-space: 5rem;}html {  scroll-padding-bottom: var(--bar-space);}body {  padding-bottom: var(--bar-space);}.buy-bar {  position: fixed;  inset-inline: 1rem;  bottom: 1rem;  display: flex;  flex-wrap: wrap;  align-items: center;  gap: 0.5rem 1rem;  padding: 0.75rem 1rem;  border-radius: 1rem;  background: #fff;}.buy-bar-name {  flex-grow: 1;}.buy-bar-add {  margin-inline-start: auto;  white-space: nowrap;}
What is wrong3 points

The bar comes last in the page, after the footer, and is fixed to the bottom of the window, with 5rem kept for it as drawn. At 320 pixels that is not enough.

  • At 320 pixels wide, the bar grows taller than the space kept for it. flex-wrap: wrap lets the button wrap onto a second row, so the bar grows to 6rem.
  • Focus can stop under the bar. The scroll padding and the padding at the end of the page still keep 5rem, 2rem short of the 7rem the bar now covers.
  • Contact us, in the last 2rem of the page, never comes out from under the bar, at any scroll position.
After

A bar that keeps to one row

:root {  /* The bar as drawn: 4rem tall, 1rem above the bottom edge. */  --bar-space: 5rem;}html {  scroll-padding-bottom: var(--bar-space);}body {  padding-bottom: var(--bar-space);}.buy-bar {  position: fixed;  inset-inline: 1rem;  bottom: 1rem;  display: flex;  align-items: center;  gap: 0.5rem 1rem;  padding: 0.75rem 1rem;  border-radius: 1rem;  background: #fff;}.buy-bar-name {  flex-grow: 1;  /* Cut the name short rather than wrap: it is the page's heading too. */  min-width: 0;  overflow: hidden;  white-space: nowrap;  text-overflow: ellipsis;}.buy-bar-add {  margin-inline-start: auto;  white-space: nowrap;}
How it is fixed2 steps
  1. Remove flex-wrap: wrap. The bar stays one row at every width and keeps the 4rem it was drawn at, so the space kept for it stays true, and every line of the page, Contact us included, can be scrolled clear of it.
  2. Let the name give up the room: min-width: 0, overflow: hidden, white-space: nowrap and text-overflow: ellipsis cut it short. At 320 pixels only its first few letters are left. The full name is still the page's heading, so nothing is lost.

The look on the phone and the desktop doesn't change. This passes 1.4.10 and 2.4.11 at 400% zoom, since nothing stays under the bar. What it doesn't change either is the share of the window: at 400% the bar still covers 5rem of a window 16rem tall, almost a third, and people read through what is left. Keep the bar's other text, and its button's label, short enough to fit one row beside the price at 320 pixels.

HTML and ARIA
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 bar, its text or the page layout changes.

Limits

This is a starting pattern, not a guarantee for every application. The 30em breakpoint and the bar's sizes are this example's; test your own bar with your longest product name, price and translation. A page that scrolls sideways at 320 pixels is a different failure, covered in pages that scroll sideways on a narrow screen. Passing at 400% doesn't make the bar easy to use at 400%: check that the page's own Add to bag button is easy to find once the bar sits in the page. Class names and tokens 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