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 the page's main action, and then its dates, 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?

  1. Press Tab from the top of the page until you reach Book now.
  2. Press Enter to open the dates, then Tab. Does focus go to the first date, or back into the page?
  3. From the dates, press Shift + Tab, then open the sheet again and close it with Escape.

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

Focus: –

Book now is Tab 9 in the page

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Write the floating button with the content it acts on, and its panel straight after it, in the markup or with popovertarget.

  1. 1A floating button that is the page's main action comes in the markup with its content, not after the footer.
  2. 2The next Tab after a button that opens a panel goes into the panel, or the panel takes focus as it opens; closing it puts focus back on the button.
  3. 3Check the order both ways, with Tab and Shift + Tab, in every browser you support.
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;}
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;}

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

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.

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.

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