Focus order drawn as a path

The canvas draws three groups of links, fields and buttons. Over them it draws the order in which the Tab key visits them: a numbered line from stop to stop. A step that goes against reading order is orange. Change the arrangement, give a button a tabindex, or leave a group out of the picture, and the line is worked out again. Press Tab, or use the two buttons under the picture, to move focus along it.

Show the code the Tab order from the DOM, the positions from the picture
  1. The markup. Three children of one canvas. Nothing in it is there for the path.
  2. The Tab order. Which elements are stops, and in what order.
  3. Where each stop is. The rectangle the browser reports for a drawn element is where it was drawn.
  4. One frame. Draw the groups, then the path over them, in the same canvas.
  5. Drawing the path.
  6. Which elements were drawn. A wrapper round drawElementImage() keeps a list for the frame.
  7. Comparing with the real Tab key. Each Tab press you make is compared with the path.

How it works

Live checks

Each check builds a small canvas of its own in a corner of the window. The picture above isn't touched.

ResultExperimentDetail

Findings

From Chromium 157, headless, on 2026-11-21. The rows above say what your browser does.