Skip to main content
Detour
Try your own page

Every second has a source

Detour is a simulation, not a score. Times come from published human-performance models run over the page’s accessibility tree. This page is the whole model, written for someone who wants to check it.

What Detour predicts

For a page and a task (“add the Trail Jacket in size M to the cart”), Detour predicts how many seconds the task takes for three people, and how that changes after code fixes.

  1. Read the page’s accessibility tree from the rendered DOM: roles, accessible names (W3C accname), focus order, headings, landmarks, geometry.
  2. Build a cost model per persona and find the cheapest way through the page for each navigation strategy.
  3. Mix strategies by how often real users choose them, then sample parameter uncertainty to get a 90% interval.
  4. Generate candidate code fixes, re-measure after each, and pick the smallest set that saves the most time.

Every number and every explanation sentence on screen is produced by deterministic code. A language model is used for three things only: pointing at the page elements a free-text task needs, proposing clearer wording for headings and unlabeled controls, and writing each planned fix as an edit to the page's own markup. It never produces a time. Each wording change is kept only if the deterministic model says it saves time, and each edit is validated, applied and re-checked on the fixed page.

Three personas

  • Mouse

    Points and clicks. Each step costs a mental operator, a Fitts’s-law pointing movement and a click. Long pages add scrolling.

  • Keyboard

    Uses Tab, Shift+Tab and skip links only. A control that cannot take focus is unreachable, so the task is blocked rather than slow. Keys are scaled by a motor factor.

  • Screen reader

    A blind user with an NVDA-style browse-mode cursor. Time is keystrokes plus listening. Unnamed controls and fake buttons cost dearly.

A persona can be blocked: no strategy can finish the task. Blocked is reported as “Can’t finish” with the reason, never as a large number. For the optimiser a blocked persona is charged 300 s.

KLM operators

The Keystroke-Level Model (Card, Moran & Newell, 1980) prices a task by summing the time of primitive operators. Detour uses five of them. Values and ranges are in the parameter table below.

KLM operators used by Detour
OperatorMeaningUsed by
KPress a navigation key (Tab, H, arrows)keyboard, screen reader
BPress or release a mouse button (a click is 2B)mouse
MMental preparation before a stepall
HMove a hand between keyboard and mousemouse (steps that type text)
PPoint at a target (fallback when geometry is missing)mouse

Fitts’s law for the mouse

When the page has layout, pointing time uses the Shannon formulation of Fitts’s law (MacKenzie, 1992), with the target’s distance from the last pointer position and its width taken from its bounding box.

MT = a + b · log2(D / W + 1)

D is the distance to the target centre, W the smaller side of the target. Small, far targets cost more bits. This is why a tiny icon button is slower for a mouse user, long before any screen reader is involved.

Screen-reader navigation as shortest paths

A screen-reader user moves a virtual cursor through the page. Detour models this as a graph: nodes are reading stops (a link, a heading, a paragraph) and edges are commands (next item, previous item, Tab, next heading, next landmark, find, activate). An edge costs a keystroke plus the time spent listening to what is announced on arrival.

cost(edge) = K + words(announcement) ÷ (wpm / 60) × f

f is the share of the announcement the user hears before moving on. It is below 1 for stops they skip past and exactly 1 at the target. Announcements come from a deterministic NVDA-style printer (“navigation landmark, list with 10 items, link, Men”), so the word count, and so the time, depends on exactly how the page is marked up.

For each strategy, Dijkstra finds the cheapest path from the top of the page to each step’s target. Properties checked in tests: it matches brute force on random graphs and adding an edge never makes a task slower.

Strategy mixture

People do not all navigate the same way. For a screen-reader user, the strategies are jumping by headings, reading line by line, using find, jumping by landmarks, and tabbing. Detour computes a path for each and weights them by how often users report choosing them when looking for information on a long page.

Screen-reader strategy shares
StrategyShare
Jump by headings72%
Find on page14%
Read line by line6%
Jump by landmarks4%
Tab key only5%

Source: WebAIM Screen Reader User Survey #10 (Dec 2023 to Jan 2024), 'When trying to find information on a lengthy web page, which of the following are you most likely to do first?', n = 1,511: headings 71.6%, Find 13.6%, read through 6.4%, links 4.8%, landmarks 3.7%. Mapping: headings to headings, Find to find, read through to linear, links to tab, landmarks to landmarks. Weights are counts / 1511.

seconds = Σi wi · ti

A strategy that cannot reach the target (a fake button is not in the Tab order) is removed and the remaining weights are renormalised. If every strategy is blocked, so is the persona.

Realistic heading search

The shortest path assumes the listener already knows which heading holds the answer. Real listeners judge each heading by its words (information scent: Pirolli & Card, 1999), open the section if it smells right, back out of it if it does not, and press H again. Detour models this as an absorbing Markov chain over the page’s headings (in the spirit of SNIF-ACT: Fu & Pirolli, 2007) and solves it exactly for the expected seconds.

t = N · c,   N = (I − Q)−1

Scent is how well a heading’s words overlap with the task wording, scored by a deterministic function (stemmed word overlap plus a small hand-written synonym table for these demo domains), with no language model in the loop. The chance of opening a section is a logistic function of scent. The panel appears when the realistic time is more than 1.3× the best case. The thresholds below are modelling assumptions, not measurements, so read the gap between “best case” and “realistic” as a risk indicator rather than a forecast.

This is also how wording suggestions are checked. When Claude proposes a new heading text, the same chain is re-solved with that text and the change is kept only if the realistic time drops. Changes that make it worse are shown as rejected.

Monte Carlo intervals

A single number would be false precision. Each parameter has a plausible range from the literature, with a distribution (uniform, triangular or log-normal). Detour draws every parameter and a strategy for each sample, re-costs each strategy’s path under those parameters (the path itself is chosen once at the nominal values, for speed), and reports the 5th to 95th percentile as a 90% interval, shown as “52 s, 90% interval 38–71 s”.

Sampling is seeded, so a result is reproducible. The interval reflects parameter and strategy uncertainty. It does not include error in the model itself (see limitations).

The optimiser: greedy, certified by exhaustive search

Candidate fixes are small code changes: add a skip link, promote a styled heading to a real heading, wrap a region in a landmark, name an unlabelled control, turn a clickable div into a button, drop a positive tabindex. Each is a deterministic transform of the page model with an HTML before/after.

objective = Σtasks ( tkeyboard + tscreen reader )  ·  blocked = 300 s

The optimiser is plain greedy: each round it re-measures every remaining candidate on top of the fixes already chosen and adds the one with the largest drop in the objective, so fixes that only pay off together (a skip link is worth little until the size picker is reachable) are still found. Greedy is not guaranteed optimal, so for k ≤ 3 Detour also searches every set of up to k fixes drawn from a pool and reports the gap. The pool is all candidates when there are at most 14; otherwise it is the union of the top 8 candidates by marginal gain in each of the first three greedy rounds plus the greedy picks. “Certified optimal among all sets of up to 3 fixes of the 11 most promising candidates (gap 0.0 s)” therefore means greedy matched the best set in that pool. It is a certificate for the pool, not for every possible combination of a larger candidate list.

Fix the page, then re-check it

The plan is a prediction on the page model. Fix this page makes it real on the page you chose. One AI agent per planned fix runs in parallel on the fast Claude tier. Each agent sees the target element’s actual markup, its parent, what a screen reader hears around it and a few computed styles, and writes the edit as a short list of operations. It keeps the original element where it can (a real button goes inside a clickable div, so the page’s own click handler still fires) and adds scoped CSS so the page looks the same.

Every edit is validated twice, on the server and again in the browser. Selectors must point at the fix’s own targets. Scripts, frames, event handlers, dangerous links and CSS that loads anything are refused. Attributes come from an allow-list. A rejected edit is tried once more with the reasons; without keys, or after a second failure, a deterministic template edit for the same fix is used and labelled as such.

Detour then applies the edits in plan order, reads the patched page again and times every person again. A fix is proven when everyone the plan unblocked can finish and every time is within half a second of the prediction or better. If not, its edit is undone and the agent gets one retry, with Detour’s own sentence on what is still wrong. Finally every element’s box is compared before and after, so a fix that moves anything for sighted users is listed. The times after a fix are still this model’s times, now computed on the patched page: they are re-checked on the fixed page, not measured.

What the language model does, and does not do

Does

  • Maps a free-text task to elements on the page.
  • Proposes clearer wording for vague headings and names for unlabeled controls.
  • Writes the markup edit for each fix the optimiser chose, against the element’s real markup.
  • Every output is validated: task targets must exist and be actionable (one retry), a heading rename is kept only if the scent model says it saves time, and an edit is sanitised and then re-checked on the fixed page.
  • Falls back to hand-pinned fixture tasks and rule-based wording when there is no key, so the demo never depends on it.

Does not

  • Produce any time, interval or percentage.
  • Choose or rank the fixes in the plan: the optimiser does.
  • Decide whether its own suggestion or edit is good: the scent model and the re-check do.
  • Write the explanations: those sentences come from a deterministic printer.

Parameters and sources

Everything the engine assumes is in one file, lib/params/literature.ts. This table is rendered from it, so it cannot drift from the code.

Human-performance parameters used by the model, with value, range, unit and source
ParameterValueRange (low–high)UnitSource
Keystroke KTab, H, arrows0.20.12–0.28 (triangular)sCard, Moran & Newell 1980/1983, KLM typist classes as tabulated in Kieras 2001: 0.12 s expert (90 wpm), 0.20 s average skilled (55 wpm), 0.28 s average non-secretary (40 wpm)
Button press Ba click is 2Bmodelling assumption0.10.08–0.15 (triangular)sCard, Moran & Newell 1983 via Kieras 2001: B = 0.1 s per press or release (a click is BB = 0.2 s)
Mental preparation M1.20.6–1.35 (triangular)sKieras 2001, after Olson & Olson 1990: M = 0.6 to 1.35 s, use 1.2 s (Card, Moran & Newell 1980 used 1.35 s)
Homing Hkeyboard ↔ mousemodelling assumption0.40.3–0.5 (triangular)sCard, Moran & Newell 1983 via Kieras 2001: H = 0.4 s
Pointing P (fallback)when no layout is available1.10.8–1.5 (triangular)sKieras 2001 / Card, Moran & Newell 1983: P ranges from 0.8 to 1.5 s with an average of 1.1 s (from Fitts's law)
Fitts intercept a0.330.12–0.51 (triangular)sSoukoreff & MacKenzie 2004, Int. J. Human-Computer Studies 61(6):751-789, Table 3: median (our computation) of eight published Shannon-form mouse-pointing regressions
Fitts slope b0.170.12–0.23 (triangular)s/bitSoukoreff & MacKenzie 2004, Table 3: slope = 1 / throughput; Shannon-form mouse models have 4.3 to 8.4 bits/s, median about 5.9 bits/s (b = 0.17)
Silent reading speed238175–300 (triangular)words/minBrysbaert 2019, J. Memory and Language 109:104047: silent reading of English non-fiction, mean 238 wpm (190 studies, 18,573 readers); most adults 175 to 300 wpm
Screen-reader speech ratemodelling assumption320200–450 (lognormal)words/minBragg et al. 2018, CHI: mean maximum intelligible rate 334 wpm for visually impaired and 297 wpm for sighted listeners; Stent et al. 2011; Asakawa et al. 2003 (judgement for a typical experienced user)
Share of an announcement heardnon-target stopsmodelling assumption0.50.25–1 (triangular)fractionModelling assumption (no measurement exists). Mechanism: NVDA cancels speech on every key press by default (NVDA source, inputCore: speechEffectWhenExecuted = SPEECHEFFECT_CANCEL)
Typing time per character0.240.12–0.48 (triangular)s/charDhakal et al. 2018, CHI, 136 M keystrokes from 168,960 typists: mean inter-key interval 238.7 ms (SD 111.6); fastest decile about 122 ms, slowest decile about 481 ms
Scroll time per viewportmodelling assumption0.80.4–1.6 (triangular)sModelling assumption anchored on Hinckley, Cutrell, Bathiche & Muss 2002, CHI: standard wheel fit MT = -0.42 + 1.25*log2(D/W+1) s gives 0.83 s for a one-screen scroll (30 lines) and 1.56 s for 60 lines
Keyboard motor factormultiplies K for the keyboard persona11–3 (triangular)xTrewin 1998 (Edinburgh PhD thesis; data of Trewin & Pain 1999, IJHCS 50(2)): mean copy-typing times of people with motor disabilities (n = 20 recruited) were 2.8 to 2.9 times those of non-disabled controls (n = 6 recruited), our ratio of the reported group means
Enter steepness αhow sharply interest in a heading rises with its scentmodelling assumption10fixedper unit of scentChosen to give plausible behaviour in the SNIF-ACT style of foraging model (Fu & Pirolli, 2007). Not fitted to data.
Scent threshold θscent at which a listener is 50% likely to open a sectionmodelling assumption0.35fixedfractionChosen to give plausible behaviour in the SNIF-ACT style of foraging model (Fu & Pirolli, 2007). Not fitted to data.
Share of a wrong section heard βhow long a listener persists before backing outmodelling assumption0.4fixedfractionChosen to give plausible behaviour in the SNIF-ACT style of foraging model (Fu & Pirolli, 2007). Not fitted to data.
Second-pass floorminimum chance of opening a section on the second pass over the headingsmodelling assumption0.5fixedfractionChosen to give plausible behaviour in the SNIF-ACT style of foraging model (Fu & Pirolli, 2007). Not fitted to data.

Limitations, stated plainly

  • It is a model, not a measurement. The intervals cover parameter and strategy uncertainty only. They do not cover error in the model structure. Treat times as relative costs that rank problems, not as forecasts for one person.
  • Parameters are literature averages from studies of other populations and devices. Rows marked “modelling assumption” have no published measurement behind the nominal value or the range (for example the share of an announcement heard, and every heading-search threshold), and are the first thing to question.
  • One screen reader flavour. Announcements approximate NVDA with default settings. JAWS, VoiceOver and TalkBack differ in wording, verbosity and hotkeys.
  • Experienced users. Strategy shares come from a survey whose respondents skew experienced. Novices will be slower and more linear.
  • Disabilities modelled: blind screen-reader use, keyboard-only use (with a motor-speed factor) and mouse use. Low vision, cognitive, hearing and switch or voice access are not modelled.
  • Static pages and known steps. Tasks are chains of element-level steps on one rendered page. Dynamic state (modals, single-page routing, form validation), content that loads later and exploratory behaviour are out of scope.
  • Fixes are patches, not guarantees. Gains are the model’s seconds. After Fix this page they are re-checked on the patched page, but they are still model seconds, and the fixed copy is the rendered page: the owner still makes the change in their own source and should review and test it. Some fixes can slow another task slightly; the per-task table shows this when it happens.
  • Validation is incomplete. The model is checked against known properties and hand-computed cases. Comparison with published empirical task times is planned, not claimed.