Repository navigation
fix(accessibility): give each frame root its own title, url and focus - #2815
Conversation
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review of 4e01383
Changes needed (1)
Picture: pending (body still has the <!-- picture --> placeholder).
moli-dom/src/accessibility/ax_properties.rs:590-592(and the test inmoli-dom/src/accessibility/tests.rs,assert_eq!(property(&properties, "focused"), Some(json!(false)))): child roots now get afocused: falseproperty. Chromium never emitsfocused: false; it adds the property only when the value is true. Chrome 157Accessibility.getFullAXTree({frameId})on the issue fixture returns["focusable=true","url=…/sub/t-child.html"]for the child root, with nofocusedentry at all. The new value reaches CDP clients and--dump semantic_tree, and the test locks it in. Smallest fix: pushfocusedonly whennode_id == document.document_node_id(), and have the test assertNonefor the child.
Checked, no finding:
- Root cause: the name now comes from
document_head_handle_for_document(node.id())and the url from the projected Document's ownurl(). For the page Document,final_url()isself.document().url(), so pages without frames come out the same as before. - Nested and srcdoc/about:blank children: each one reads its own Document. moli seeds
about:srcdocandabout:blank(child_frames.rs:1303-1317), which matches Chrome'surlfor those frames. - Untitled documents: Chrome gives
""for every untitled root (top, child, srcdoc, about:blank). The PR keeps moli's existing URL fallback and applies it the same way to top and child roots. That is consistent, and for agents it is the better choice:semantic_tree_textshows only the name, so an empty name would make an untitled frame indistinguishable. - CDP
getFullAXTree/getRootAXNodewith a childframeIdgo through the same arena Document (moli-protocol/src/domains/accessibility/native.rs:141-150). They now report the child's own title and url, which matches Chrome. This is an intended improvement. - Focus inside a child frame (not caused by this PR, follow-up only): Chrome then marks the child root and the focused element
focusedand leaves the top root unfocused. moli has no AX focus tracking yet, so "top root only" is the right default here. The code comment should not claim that frames never hold focus. - The regression test fails without the fix (the child name would be "Top title"). The Cost section is plausible. CI: Nextest, CDP smoke and the release builds are still pending; everything that has completed passes.
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review of a90bd9c (round 2)
No blocking findings
The round-1 finding is fixed. focused is now emitted only for the page Document (ax_properties.rs:590-595), child roots omit it as Chromium does, and the test asserts None for the child root. The comment no longer claims that frames never hold focus. Nothing else changed since 4e01383.
CI Regression ReportSource CI run · source state at render:
Release regression — ✅ HEAD/base failures 0/0; raw binary 0.00%Package and image size
Startup latency and PSS
Concurrency matrix
Frontend differential — ✅ 1,020/1,020 cases matched; 0 issues
Agent episodes · Moli vs Chromium — ✅ 8/8 Moli episodes passed; 0 failures
Runtime and CDP session contracts — ✅ 26 contract cases; 0 failures
CDP smoke — ✅ 118/118 groups passed; 1,754 scenariosWorkers: 4 · cumulative group time: 454.91 s · failed groups: 0
WebMainBench · 545 pages — ✅ 545/545 completed; 0 unexpected failures
Frozen HTML · Linux · Diagnostics: All artifact fields are parsed by the trusted default-branch renderer; missing or invalid inputs remain visible as unavailable. |
Sequential Navigation Soak A/B✅ HEAD completed the 200-navigation resilience and memory observation. One browser process, one target, and one CDP session navigate CSDN → SegmentFault → Huaban → example.com repeatedly. This run issued 200 Common ancestor Session resilience
A public-page failure is reported separately from an unrecoverable session. The soak requires all navigation attempts, zero failed recovery, zero lifecycle/network ordering violations, and complete resource evidence. Process-tree memory
HEAD memory by 50-navigation quarter
Raw reports and per-navigation boundary samples: workflow run and full Public-site timing and memory are observational. Use the A/B deltas and trend shape as evidence, not as a deterministic performance threshold. |
Spider Bench A/B✅ All benchmark browser service runs completed; results are informational. Public HEAD: 184 / 240 rows; 38 / 48 sites produced rows; 10 unexpected empty sites. ✅ Deterministic fixture contract is clean. Common ancestor Public 48-site run · informational
Public-site content, timing, and memory are noisy. This single A/B run reports evidence only; site outcome counts explain missing rows without treating them as a deterministic regression. CPU and memory timelinesThese are bounded 40-point views of the same complete process-tree samples used by the HTML report. CPU uses 100% per occupied logical core; memory lines are RSS first and PSS second when complete PSS samples are available. Basexychart-beta
title "Base CPU"
x-axis "Elapsed seconds" [1.537, 3.04, 4.541, 6.044, 7.045, 8.546, 10.049, 11.55, 13.052, 14.553, 16.056, 17.057, 17.557, 19.06, 20.062, 21.564, 23.066, 24.569, 26.072, 27.574, 29.076, 30.578, 32.08, 33.081, 34.583, 35.084, 36.084, 37.586, 39.088, 40.59, 42.092, 43.595, 45.097, 46.097, 47.6, 49.1, 50.601, 51.603]
y-axis "CPU percent" 0 --> 200
line [91.89, 99.79, 135.79, 113.74, 75.95, 129.88, 115.92, 99.92, 143.89, 17.99, 2, 0, 4, 2, 21.95, 73.93, 125.92, 121.85, 121.75, 53.94, 91.87, 85.91, 111.88, 33.99, 115.76, 117.85, 135.78, 2, 25.93, 57.99, 27.91, 2, 117.84, 4, 109.86, 138, 123.76, 145.92]
xychart-beta
title "Base memory: RSS then PSS"
x-axis "Elapsed seconds" [0.036, 1.537, 3.04, 4.541, 6.044, 7.045, 8.546, 10.049, 11.55, 13.052, 14.553, 16.056, 17.057, 17.557, 19.06, 20.062, 21.564, 23.066, 24.569, 26.072, 27.574, 29.076, 30.578, 32.08, 33.081, 34.583, 35.084, 36.084, 37.586, 39.088, 40.59, 42.092, 43.595, 45.097, 46.097, 47.6, 49.1, 50.601, 51.603, 51.789]
y-axis "Memory MiB" 0 --> 500
line [13.61, 96.76, 130.86, 134.15, 151.88, 136.96, 130.51, 144.52, 135.5, 159.96, 120.63, 125.84, 124.01, 124, 124.04, 130.09, 134.4, 160.35, 176.11, 200.53, 145.04, 185.18, 138.37, 147.43, 143.22, 218.21, 252.27, 248.75, 223.9, 230.71, 235.12, 231.37, 231.42, 152.18, 134.65, 154.86, 167.58, 161.74, 162.16, 0]
line [10.83, 93.87, 128.1, 131.1, 148.96, 134.22, 127.57, 141.63, 132.59, 157.08, 117.7, 122.91, 121.08, 121.06, 121.11, 127.16, 131.32, 157.41, 173.16, 197.62, 142.2, 182.22, 135.18, 144.5, 140.36, 215.58, 249.84, 245.81, 220.96, 227.78, 232.18, 228.43, 228.48, 149.24, 131.72, 152.09, 164.64, 158.84, 158.38, 0]
HEADxychart-beta
title "HEAD CPU"
x-axis "Elapsed seconds" [1.537, 3.038, 4.539, 5.54, 7.041, 8.543, 10.045, 11.547, 13.049, 14.05, 15.552, 17.055, 18.557, 20.059, 20.559, 21.56, 22.561, 24.063, 25.564, 27.067, 28.57, 30.072, 31.074, 32.576, 34.079, 35.581, 37.083, 38.084, 38.585, 39.586, 41.087, 42.588, 44.091, 45.593, 47.095, 48.097, 49.598, 50.6]
y-axis "CPU percent" 0 --> 200
line [77.98, 109.91, 145.99, 133.8, 111.93, 85.93, 45.99, 121.75, 45.94, 141.78, 4, 83.8, 105.8, 125.87, 99.94, 121.88, 139.87, 125.84, 145.79, 117.75, 55.93, 109.78, 27.97, 149.74, 103.83, 21.98, 29.96, 0, 25.99, 23.97, 2, 29.95, 15.97, 11.99, 97.78, 111.82, 125.8, 163.68]
xychart-beta
title "HEAD memory: RSS then PSS"
x-axis "Elapsed seconds" [0.036, 1.537, 3.038, 4.539, 5.54, 7.041, 8.543, 10.045, 11.547, 13.049, 14.05, 15.552, 17.055, 18.557, 20.059, 20.559, 21.56, 22.561, 24.063, 25.564, 27.067, 28.57, 30.072, 31.074, 32.576, 34.079, 35.581, 37.083, 38.084, 38.585, 39.586, 41.087, 42.588, 44.091, 45.593, 47.095, 48.097, 49.598, 50.6, 50.919]
y-axis "Memory MiB" 0 --> 500
line [13.53, 92.58, 123.89, 130.14, 142.43, 146.67, 120.98, 144.88, 129.89, 125.55, 155.5, 118.46, 139.76, 145.52, 186.2, 256.79, 182.15, 187.78, 154.57, 161.44, 144.77, 138.12, 143.31, 139.59, 185.73, 241.8, 222.79, 233.7, 230.52, 228.6, 232.85, 231.68, 229.26, 155.87, 132.91, 166.67, 153.02, 164.64, 156.9, 0]
line [10.73, 89.63, 120.99, 127.21, 139.5, 143.9, 118.2, 141.9, 126.64, 122.62, 152.59, 115.53, 137.06, 142.45, 183.18, 254.17, 179.11, 184.76, 151.52, 158.44, 141.65, 135.07, 140.32, 136.53, 181.04, 239.34, 219.74, 230.65, 227.47, 225.55, 230, 228.84, 226.41, 153.02, 130.09, 163.82, 150.18, 161.8, 154.05, 0]
Deterministic fixture · required contractThe fixture exercises 15 routes: 8 are expected to emit rows and 7 intentionally exercise empty, loading, or timeout behavior.
Full HTML, JSON, CSV, logs, and page snapshots: workflow run and full The public-web A/B is informational. The exact HEAD fixture contract runs as a separate required CI check; timing and public-site content deltas remain non-blocking. |
a90bd9c to
e083ed7
Compare

**Track:** Web Fetch (Browser Eval). Replaces part of #1592.Closes #2775.
Problem. In
moli fetch URL --dump semantic_tree --with-frames, every child frame'sRootWebAreaused the top document's title as its name and the top document's URL, and every root claimedfocused: true. Agents could not tell which frame a subtree came from. Repro (issue fixture):moli fetch http://127.0.0.1:8000/tnest.html --dump semantic_tree_text --with-frames | grep RootWebArea.Reproduce (steps from #2775)
Expected (Chromium)
Child title,url=http://…/sub/t-child.html, not focused.Top title,focused=true.Actual
In
--dump semantic_tree, the child root hasname "Top title",url "http://…/tnest.html"andfocused: true. With nested untitled frames, every root reads the top-level URL.Change. In
moli-dom/src/accessibility/ax_properties.rs, the Document name and properties readdocument_head_handle()andfinal_url(). Those belong to the arena's page Document, not the Document node being projected; child frame Documents share the arena.ax_document_namenow uses the projected node:document_head_handle_for_document(node.id())for the title, and that Document's ownurl()as the fallback.NodeData::Documentproperties report the projected Document's ownurl.focused: trueis emitted only for the page's Document (node_id == document.document_node_id()). Other roots omit the property, as Chromium does for unfocused roots. Moli has no AX focus tracking yet, so a frame root that contains the focused element is not marked either.Verification.
--dump semantic_treeroots (name, url, focused):ax_child_document_root_uses_its_own_title_url_and_focus(moli-dom/src/accessibility/tests.rs). It builds a second Document in the same arena and checks the name,urlandfocusedof both roots; the child root has nofocusedproperty.cargo nextest run -p moli-dom -E 'test(ax_)': 31 passed.cargo nextest run -p moli -p moli-renderer-v8 -E 'test(semantic) | test(accessibility) | test(ax_) | test(full_ax)': 131 passed.cargo fmt --allclean;cargo clippy -p moli-dom --all-targets --all-features -- -D warningsclean (workspace clippy not run locally).Cost. Only Document nodes are affected: the same head lookup, now keyed by the projected Document, and one handle comparison. Debug builds of main cbf4d01 and this branch (on a newer main), same profile,
/usr/bin/time -l, alternating runs, median of 7:--dump semantic_tree --with-frames--dump semantic_tree--dump semantic_tree_text