Skip to content
easeweb
Search topics

Focus order that jumps around the page

CSS reverses a row of buttons on screen while the markup keeps the old order, so Tab moves against the layout.

WCAG 2.2
SC 2.4.3A
Required by
Section 508 · EN 301 549 (EU)
Broken flex-direction: row-reverse
The accessibility problem illustrated: Motor:Why does it start at Back?
01

The problem

Keyboard users watch focus move against the layout, lose their place, and can press the wrong button

02

Try it

Press Tab and watch which way focus moves

  • Broken 1: Tab from the discount code through the three buttons. Does focus move the way the page reads, top to bottom and left to right?

  • Broken 2: Tab into the checkout from above it. Where does focus land first, and when do you reach the discount code?

  • Apply a fix. Tab from the discount code through the three buttons again. Does focus move the way the page reads?

Broken Can you fix this?

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Make the markup order and the layout agree

Before

A row reversed in CSS

<div class="actions">  <a href="/basket">Back to basket</a>  <button type="button">Save for later</button>  <button type="submit">Place order</button></div>
What is wrong2 points
  • Focus moves against the way the row reads. row-reverse shows the row as place, save, back from left to right, but focus visits back, save, place.
  • Screen readers announce the actions in the opposite order to the screen too. The CSS changed what people see and left the order that keyboards and screen readers use.
After

Markup that follows the design

<div class="actions">  <button type="submit">Place order</button>  <button type="button">Save for later</button>  <a href="/basket">Back to basket</a></div>
How it is fixed2 steps
  1. List the actions in the markup in the order the design shows. Tab moves from "Place order" to "Save for later" to "Back to basket", left to right, as the page reads.
  2. Drop row-reverse and the positive tabindex values, and keep the row at the right with justify-content: flex-end. The look is unchanged.

This fixes both Befores and passes 2.4.3.

04

Verify the fix

4 checks, no mouse.

Test with: Keyboard, Screen reader, Zoom

0 of 4 checked

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

Limits

This is a starting pattern, not a guarantee for every application. It covers a static row of actions. Text that CSS moves away from its place in the markup, with nothing focusable in it, is covered in reading order that doesn't match the layout. A floating button, or the panel a button opens, written at the end of the page while it is drawn somewhere else, is covered in floating buttons and panels that keyboard focus reaches last. Data grids, carousels and widgets that move focus with arrow keys follow their own patterns and need their own checks. Whether an order preserves meaning is a judgement about the content, so test the complete journey on your real pages.

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