Skip to content
easeweb
Search topics

Floating buy bars that cover the page when zoomed in

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

WCAG 2.2
SC 2.4.11AA· new in 2.2SC 1.4.10AA· new in 2.1
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?

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. The bar sits at the end of the page.

All of the page can be scrolled clear of it

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Keep the bar to one row so the space kept for it stays true, and let it sit in the page when the window is short.

  1. 1At every width, a floating bar is no taller than the space kept for it, so focus always stops above it.
  2. 2Scrolled to the end, nothing on the page is still under a floating element.
  3. 3Check the page at 400% zoom in a 1280 by 1024 window, and on a phone held on its side.
Before A 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;}
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;}

Fixing this with an AI coding assistant? Get this guide as Markdown, or get every guide in your coding agent.

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.

Keep this fixed as your code changes.

Turn guides like this into rules your coding agents and CI follow, then have the result retested with a keyboard and screen readers.

How retests work