Skip to content

fix(accessibility): give each frame root its own title, url and focus - #2815

Merged
ldm0 merged 2 commits into
mainfrom
fix/ax-child-document-root
Nov 19, 2026
Merged

ldm0 merged 2 commits into
mainfrom
fix/ax-child-document-root

Conversation

@lanyue-llk

@lanyue-llk lanyue-llk commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

PR #2815 at a glance

**Track:** Web Fetch (Browser Eval). Replaces part of #1592.

Closes #2775.

Problem. In moli fetch URL --dump semantic_tree --with-frames, every child frame's RootWebArea used the top document's title as its name and the top document's URL, and every root claimed focused: 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)
mkdir -p sub
echo '<!doctype html><title>Top title</title><p>Top</p><iframe src="sub/t-child.html"></iframe>' > tnest.html
echo '<!doctype html><title>Child title</title><p>CHILD</p>' > sub/t-child.html
python3 -m http.server 8000 &
moli fetch http://127.0.0.1:8000/tnest.html --dump semantic_tree_text --with-frames | grep RootWebArea

Expected (Chromium)

  • Child root: name Child title, url=http://…/sub/t-child.html, not focused.
  • Top root: name Top title, focused=true.

Actual

- RootWebArea: Top title [backendNodeId=2000000000]
        - RootWebArea: Top title [backendNodeId=2000000006]

In --dump semantic_tree, the child root has name "Top title", url "http://…/tnest.html" and focused: 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 read document_head_handle() and final_url(). Those belong to the arena's page Document, not the Document node being projected; child frame Documents share the arena.

  • ax_document_name now uses the projected node: document_head_handle_for_document(node.id()) for the title, and that Document's own url() as the fallback.
  • The NodeData::Document properties report the projected Document's own url.
  • focused: true is 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.

v1.1.23                                          this branch
- RootWebArea: Top title [...2000000000]          - RootWebArea: Top title [...2000000000]
        - RootWebArea: Top title [...2000000007]          - RootWebArea: Child title [...2000000007]
        - RootWebArea: Top title [...2000000012]          - RootWebArea: about:srcdoc [...2000000012]

--dump semantic_tree roots (name, url, focused):

root v1.1.23 this branch
top Top title, …/tnest.html, true Top title, …/tnest.html, true
src child Top title, …/tnest.html, true Child title, …/sub/t-child.html, (absent)
untitled srcdoc child Top title, …/tnest.html, true about:srcdoc, about:srcdoc, (absent)
  • New test 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, url and focused of both roots; the child root has no focused property.
  • 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 --all clean; cargo clippy -p moli-dom --all-targets --all-features -- -D warnings clean (workspace clippy not run locally).
  • Not run locally: the full workspace nextest (the renderer test binary does not link within local RAM); left to CI.

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:

case main wall / max RSS branch wall / max RSS
tnest.html --dump semantic_tree --with-frames 0.12 s / 93.6 MB 0.12 s / 93.5 MB
ordinary local article --dump semantic_tree 0.16 s / 91.4 MB 0.17 s / 91.2 MB
ordinary local article --dump semantic_tree_text 0.16 s / 91.1 MB 0.16 s / 91.1 MB

@lanyue-llk lanyue-llk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review of 4e01383

Changes needed (1)

Picture: pending (body still has the <!-- picture --> placeholder).

  1. moli-dom/src/accessibility/ax_properties.rs:590-592 (and the test in moli-dom/src/accessibility/tests.rs, assert_eq!(property(&properties, "focused"), Some(json!(false)))): child roots now get a focused: false property. Chromium never emits focused: false; it adds the property only when the value is true. Chrome 157 Accessibility.getFullAXTree({frameId}) on the issue fixture returns ["focusable=true","url=…/sub/t-child.html"] for the child root, with no focused entry at all. The new value reaches CDP clients and --dump semantic_tree, and the test locks it in. Smallest fix: push focused only when node_id == document.document_node_id(), and have the test assert None for 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 own url(). For the page Document, final_url() is self.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:srcdoc and about:blank (child_frames.rs:1303-1317), which matches Chrome's url for 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_text shows only the name, so an empty name would make an untitled frame indistinguishable.
  • CDP getFullAXTree/getRootAXNode with a child frameId go 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 focused and 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 lanyue-llk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

CI Regression Report

Source CI run · source state at render: in_progress · artifacts: 6/6

Check Status Signal
Release regression ✅ HEAD/base failures 0/0; raw binary 0.00%
Frontend differential ✅ 1,020/1,020 cases matched; 0 issues
Agent episodes ✅ 8/8 Moli episodes passed; 0 failures
Runtime/CDP contracts ✅ 26 contract cases; 0 failures
CDP smoke ✅ 118/118 groups passed; 1,754 scenarios
WebMainBench ✅ 545/545 completed; 0 unexpected failures
Release regression — ✅ HEAD/base failures 0/0; raw binary 0.00%

Package and image size

Metric Base HEAD Delta Delta %
Raw binary 154.52 MiB 154.52 MiB 0 B 0.00%
Stripped binary 106.93 MiB 106.93 MiB 0 B 0.00%
gzip binary 53.41 MiB 53.41 MiB −287 B −0.000512%
Rootfs 161.43 MiB 161.43 MiB 0 B 0.00%
gzip rootfs 62.51 MiB 62.51 MiB −216 B −0.000330%

Startup latency and PSS

Case Base p50 HEAD p50 Delta Base PSS HEAD PSS Delta
Serve ready 27.28 ms 26.89 ms −0.39 ms 4.53 MiB 4.88 MiB +353.00 KiB
CDP first page 49.81 ms 49.01 ms −0.81 ms 5.10 MiB 4.26 MiB −862.50 KiB
CDP warm page 11.38 ms 11.19 ms −0.19 ms 53.12 MiB 53.23 MiB +111.50 KiB
CLI about:blank 12.44 ms 13.17 ms +0.73 ms 4.78 MiB 3.89 MiB −908.00 KiB
CLI local JS 25.46 ms 26.82 ms +1.36 ms 4.22 MiB 2.69 MiB −1.53 MiB

Concurrency matrix

Concurrency Base p50 HEAD p50 Delta Base PSS HEAD PSS Delta HEAD failures Unstable B/H
1 24.48 ms 24.38 ms −0.10 ms 629.00 KiB 642.00 KiB +13.00 KiB 0 0/0
5 28.24 ms 28.96 ms +0.73 ms 19.00 MiB 12.07 MiB −6.93 MiB 0 0/0
10 30.32 ms 28.86 ms −1.46 ms 12.74 MiB 12.78 MiB +38.00 KiB 0 0/0
25 27.73 ms 29.37 ms +1.64 ms 12.67 MiB 12.96 MiB +301.50 KiB 0 0/0
100 29.47 ms 28.46 ms −1.01 ms 19.47 MiB 12.70 MiB −6.77 MiB 0 0/0
Frontend differential — ✅ 1,020/1,020 cases matched; 0 issues
Match DOM mismatch Diagnostic mismatch Moli error Reference error Infrastructure error Mismatched frames Duration
1,020 0 0 0 0 0 0 6m 57.59s
Agent episodes · Moli vs Chromium — ✅ 8/8 Moli episodes passed; 0 failures
Fast contract Episodes Passed Assertions Ready p50 Episode p50
Moli 8 8 47/47 28.61 ms 29.40 ms
Chromium 8 8 47/47 272.84 ms 86.80 ms
Operation p50 Chromium Moli Delta Delta %
navigate 43.61 ms 5.81 ms −37.80 ms −86.68%
observe 0.81 ms 0.94 ms +0.13 ms +15.75%
fill 3.87 ms 3.64 ms −0.23 ms −5.91%
click 6.05 ms 4.32 ms −1.73 ms −28.62%
Idle-resource episode Peak RSS Peak PSS Average CPU Peak CPU Peak processes Sampler
Moli 70.48 MiB 68.67 MiB 0.89% 10.02% 1 ✅
Chromium 1308.23 MiB 420.55 MiB 1.72% 76.50% 13 ⚠️ PSS partial
Runtime and CDP session contracts — ✅ 26 contract cases; 0 failures
Suite Cases Failures Median case p50 Median case p95 Median peak PSS p50
Synthetic fetch 13 0 24.53 ms 25.35 ms 726.00 KiB
Long-lived CDP session 13 0 17.91 ms 18.32 ms —
CDP smoke — ✅ 118/118 groups passed; 1,754 scenarios

Workers: 4 · cumulative group time: 454.91 s · failed groups: 0

Slowest group Scenarios Duration Status
dom-input 62 22.76 s ✅
dom-input 62 22.73 s ✅
fetch-resource-dispatch 72 21.36 s ✅
fetch-resource-dispatch 72 21.34 s ✅
scrollbar-visibility 22 17.48 s ✅
WebMainBench · 545 pages — ✅ 545/545 completed; 0 unexpected failures
Completed Successful Expected DNS failure Unexpected failures Panics Crashes Timeouts Empty output
545/545 544 1 0 0 0 0 0

Frozen HTML · Linux · --wait done · 45 seconds per page · no retries. Content quality is evaluated separately.

Diagnostics: webmainbench-results — every page's Markdown, stderr, and exit status. Source run and artifacts

All artifact fields are parsed by the trusted default-branch renderer; missing or invalid inputs remain visible as unavailable.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

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 Page.navigate commands per binary.

Common ancestor 16861c2e39 → HEAD e083ed7dc8; benchmark order: head-first; workflow: success.

Session resilience

Metric Base HEAD
Attempted / planned 200 / 200 200 / 200
Direct observable pass 192 / 200 195 / 200
Failures / recovered 8 / 8 5 / 5
Recovery failures 0 0
Lifecycle order violations 0 0
Network order violations 0 0
Wall time 742.7 s 714.9 s

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

Metric Base HEAD Δ
Boundary samples 200 200 0
Boundary RSS samples 200 200 0
Boundary PSS samples 200 200 0
Periodic peak RSS 250.1 MiB 246.4 MiB -3.7 MiB
Periodic peak PSS 247.4 MiB 243.4 MiB -4.0 MiB
RSS · first 10 avg 178.7 MiB 171.3 MiB -7.4 MiB
RSS · last 10 avg 196.3 MiB 192.6 MiB -3.7 MiB
RSS · last − first window +17.6 MiB +21.2 MiB +3.7 MiB
RSS · warm slope / 100 nav +7.6 MiB +4.8 MiB -2.8 MiB
PSS · first 10 avg 175.9 MiB 168.4 MiB -7.5 MiB
PSS · last 10 avg 193.1 MiB 189.7 MiB -3.5 MiB
PSS · last − first window +17.2 MiB +21.3 MiB +4.1 MiB
PSS · warm slope / 100 nav +7.4 MiB +5.2 MiB -2.2 MiB
Peak file descriptors 67 69 2
Peak threads 33 33 0

HEAD memory by 50-navigation quarter

HEAD range Avg RSS Final RSS Peak RSS Avg PSS Final PSS Peak FD
1–50 177.3 MiB 151.3 MiB 220.0 MiB 174.2 MiB 148.0 MiB 58
51–100 182.3 MiB 212.9 MiB 219.4 MiB 178.6 MiB 209.8 MiB 62
101–150 179.9 MiB 167.9 MiB 217.5 MiB 177.0 MiB 165.0 MiB 57
151–200 187.8 MiB 136.2 MiB 228.3 MiB 184.9 MiB 133.4 MiB 58

Raw reports and per-navigation boundary samples: workflow run and full sequential-navigation-soak-results artifact.

Public-site timing and memory are observational. Use the A/B deltas and trend shape as evidence, not as a deterministic performance threshold.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

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 16861c2e39e8 → HEAD e083ed7dc83b; benchmark order: head-first; workflow: success.

Public 48-site run · informational

Metric Base HEAD Δ
Run status success success —
Extracted rows / contract 184 / 240 184 / 240 0 (0.00%)
Contract fill 76.67% 76.67% 0.00 pp (0.00%)
Sites with rows 38 / 48 38 / 48 0 (0.00%)
Sites meeting row contract 36 / 48 36 / 48 0 (0.00%)
Unexpected empty sites 10 10 0 (0.00%)
Partial-row sites 2 2 0 (0.00%)
Site outcomes extracted: 37; HTTP error + rows: 1; empty: 8; HTTP error + empty: 1; snapshot error + empty: 1 extracted: 36; HTTP error + rows: 2; empty: 8; HTTP error + empty: 1; snapshot error + empty: 1 —
Observed duration 51.79 s 50.92 s -0.87 s (-1.68%)
Estimated CPU 40.25 s 40.74 s +0.49 s (+1.22%)
Peak PSS 249.84 MiB 254.17 MiB +4.33 MiB (+1.73%)
Peak RSS 252.27 MiB 256.79 MiB +4.52 MiB (+1.79%)
Peak threads 32 32 0 (0.00%)
Mismatched sites 0 0 0
Timeout with items 0 0 0
Category rows Base HEAD Δ
news 35 / 40 35 / 40 0
stocks 20 / 40 20 / 40 0
tech 35 / 40 35 / 40 0
sports 27 / 40 27 / 40 0
games 32 / 40 32 / 40 0
life 35 / 40 35 / 40 0

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 timelines

These 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.

Base

xychart-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]
Loading
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]
Loading

HEAD

xychart-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]
Loading
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]
Loading

Deterministic fixture · required contract

The fixture exercises 15 routes: 8 are expected to emit rows and 7 intentionally exercise empty, loading, or timeout behavior.

Metric Base HEAD Δ
Run status success success —
Extracted rows / contract 40 / 40 40 / 40 0 (0.00%)
Contract fill 100.00% 100.00% 0.00 pp (0.00%)
Sites with rows 8 / 15 8 / 15 0 (0.00%)
Sites meeting row contract 15 / 15 15 / 15 0 (0.00%)
Unexpected empty sites 0 0 0
Partial-row sites 0 0 0
Site outcomes extracted: 7; HTTP error + rows: 1; empty: 3; timeout + empty: 4 extracted: 7; HTTP error + rows: 1; empty: 3; timeout + empty: 4 —
Observed duration 19.86 s 19.86 s +0.01 s (+0.04%)
Estimated CPU 0.43 s 0.43 s +0.00 s (+0.23%)
Peak PSS 70.07 MiB 70.42 MiB +0.36 MiB (+0.51%)
Peak RSS 73.54 MiB 73.41 MiB -0.14 MiB (-0.19%)
Peak threads 21 21 0 (0.00%)
Mismatched sites 0 0 0
Timeout with items 0 0 0

Full HTML, JSON, CSV, logs, and page snapshots: workflow run and full spider-bench-results artifact.

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.

@lanyue-llk
lanyue-llk force-pushed the fix/ax-child-document-root branch from a90bd9c to e083ed7 Compare November 13, 2026 12:13
@ldm0
ldm0 merged commit d5e1ced into main Nov 19, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--dump semantic_tree --with-frames gives every child RootWebArea the top document title, URL and focus

2 participants