Skip to content
easeweb
Search topics

Floating buttons and panels that keyboard focus reaches last

A floating Book now bar and the sheet it opens are written after the footer, so keyboard and screen reader users reach them only after the whole page.

WCAG 2.2
SC 2.4.3A
Required by
Section 508 · EN 301 549 (EU)
Broken
The accessibility problem illustrated: Motor:Why is Book now last?
01

The problem

Keyboard and screen reader users reach the page's Book now button only after the whole page, and once it opens the dates, reach those only after the whole page again

02

Try it

Book the tour with the keyboard. How many Tab presses does it take?

  • Broken 1: press Tab from the top of the page until you reach Book now. Does it come before the footer, or after it?

  • Broken 2: Tab to Book now, press Enter to open the dates, then Tab. Does focus go to the first date, or back into the page?

  • Apply a fix. Book with Tab and Enter again. From the dates, press Shift + Tab, then open the sheet again and close it with Escape. Where does focus go each time?

Broken Can you fix this?

Old town walking tour

2 hours, from $25 a person

A stone fountain beside a quiet cobbled street in the old town.

Meeting point: the fountain in Market Square. Open in maps

Is the route step-free?

Yes. The route keeps to the flat streets of the old town.

What if it rains?

The tour goes ahead, with a covered stop at the market hall.

Can I cancel?

Yes, free of charge up to 24 hours before the start.

Read all 128 reviews

From $25

Tab presses to Book now: 9

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Put the button and panel in their place in the Tab order

Before

The bar and its sheet after the footer

/* Room for the bar, so it never covers the end of the page or focus. */html {  scroll-padding-bottom: 5rem;}body {  padding-bottom: 5rem;}.book-bar {  position: fixed;  inset-inline: 1rem;  bottom: 1rem;  display: flex;  align-items: center;  justify-content: space-between;  /* 4rem tall and 1rem above the bottom edge: the 5rem kept for it. */  height: 4rem;  padding: 0 1rem;  border-radius: 1rem;  background: #fff;}.sheet {  position: fixed;  inset-inline: 1rem;  bottom: 5.5rem;  padding: 1rem;  border-radius: 1rem;  background: #fff;}
What is wrong2 points

The button, its state, the closing and the room kept for the bar are all written well, and the sheet comes straight after the bar, so once Book now is reached, the dates are the next Tab. Only the place of the bar is wrong.

  • Book now is on screen from the start, but Tab reaches it last. The bar is written after the footer, and position: fixed only draws it at the bottom of the screen.
  • A keyboard user presses Tab nine times to reach Book now, going through Open in maps, the three questions, the reviews link and the footer's three links first.
After

The bar with its content, the sheet straight after it

/* Room for the bar, so it never covers the end of the page or focus. */html {  scroll-padding-bottom: 5rem;}body {  padding-bottom: 5rem;}.book-bar {  position: fixed;  inset-inline: 1rem;  bottom: 1rem;  display: flex;  align-items: center;  justify-content: space-between;  /* 4rem tall and 1rem above the bottom edge: the 5rem kept for it. */  height: 4rem;  padding: 0 1rem;  border-radius: 1rem;  background: #fff;}.sheet {  position: fixed;  inset-inline: 1rem;  bottom: 5.5rem;  padding: 1rem;  border-radius: 1rem;  background: #fff;}
How it is fixed4 steps
  1. Move the bar in the markup to right after the price, which it repeats. position: fixed still draws it in the same place on screen, and Book now is the first Tab in the page.
  2. Move the sheet to right after the bar. With the sheet open, Tab from Book now goes to the first date, and Shift + Tab from the dates goes back to Book now.
  3. Keep the focusout listener. Tab past Continue goes on to Open in maps and closes the sheet, so the link with focus is never under it.
  4. Keep hidden on the closed sheet, which keeps it out of the order.

Nothing else changes. A screen reader reading from the top meets the bar after the price, and the sheet next. This fixes both Befores and passes 2.4.3: it is technique C27 for the bar, and technique SCR26, putting content that a control reveals straight after it, for the sheet. It depends on position: fixed still meaning the window: a parent with transform, filter or contain makes the bar and the sheet fixed to that parent instead, and a parent's z-index can draw later content over them, so check their parents.

04

Verify the fix

6 checks, no mouse.

Test with: Keyboard, Screen reader

0 of 6 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 sheet or the page layout changes, and after a booking widget, component library or third-party script is updated.

How screen readers handle aria-expanded

Limits

This is a starting pattern, not a guarantee for every application. The bar, its sheet and the tour are this example's; test every floating button on the page, and every panel one opens, including chat, help and feedback panels, with the longest page it appears on. Whether a floating button belongs at the end of the order is a judgement about the page: a back to top button does, and a page's main action doesn't. A chat panel also has to read its messages out, as in chat widgets that never announce their messages. Popover focus order depends on the browser, so test it in each one you support. 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