SemanticTree: improve accessibility tree and name calculation

- Add more structural roles (banner, navigation, main, list, etc.).
- Implement fallback for accessible names (SVG titles, image alt text).
- Skip children for leaf-like semantic nodes to reduce redundancy.
- Disable pruning in the default semantic tree view.
This commit is contained in:
Adrià Arrufat
2026-03-09 21:04:47 +09:00
parent 61cba3f6eb
commit 85ebbe8759
3 changed files with 62 additions and 7 deletions

View File

@@ -113,12 +113,12 @@ pub fn fetch(app: *App, url: [:0]const u8, opts: FetchOpts) !void {
var registry = CDPNode.Registry.init(app.allocator);
defer registry.deinit();
const st = SemanticTree{
const st: SemanticTree = .{
.dom_node = page.window._document.asNode(),
.registry = &registry,
.page = page,
.arena = page.call_arena,
.prune = true,
.prune = false,
};
if (mode == .semantic_tree) {