9.2 · Layout
Tab in visual order: reading-flow
Keyboard focus follows the visual order, not the DOM order.
order, grid placement and
flex-direction: row-reverse change what you see, but
keyboard focus still follows the HTML order. That makes focus jump
around for keyboard and screen reader users.
reading-flow: flex-visual on a flex container, or
grid-rows on a grid, makes focus and reading order follow
the layout. Reorder for design without breaking navigation.
<!-- Keep visual and DOM order the same,
or patch tab order by hand: -->
<button tabindex="2">…</button>
<button tabindex="1">…</button>
.toolbar {
display: flex;
reading-flow: flex-visual;
}
.b3 { order: 1; }