mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 19:47:17 +02:00
LibWeb/DOM: Set missing JSON attributes for a11y text nodes
Firefox DevTools expects all nodes to have an ID and type, and for a text node's name to be its text.
This commit is contained in:
Notes:
github-actions[bot]
2025-10-20 09:52:31 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/c9811af3b59 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6462 Reviewed-by: https://github.com/trflynn89
@@ -42,7 +42,6 @@ void AccessibilityTreeNode::serialize_tree_as_json(JsonObjectSerializer<StringBu
|
||||
MUST(object.add("name"sv, name));
|
||||
auto description = MUST(element->accessible_description(document));
|
||||
MUST(object.add("description"sv, description));
|
||||
MUST(object.add("id"sv, element->unique_id().value()));
|
||||
|
||||
if (has_role)
|
||||
MUST(object.add("role"sv, ARIA::role_name(*role)));
|
||||
@@ -55,9 +54,12 @@ void AccessibilityTreeNode::serialize_tree_as_json(JsonObjectSerializer<StringBu
|
||||
MUST(object.add("type"sv, "text"sv));
|
||||
|
||||
auto const* text_node = static_cast<DOM::Text const*>(value().ptr());
|
||||
MUST(object.add("text"sv, text_node->data().to_utf8()));
|
||||
MUST(object.add("name"sv, text_node->data().to_utf8()));
|
||||
MUST(object.add("role"sv, "text leaf"sv));
|
||||
}
|
||||
|
||||
MUST(object.add("id"sv, value()->unique_id().value()));
|
||||
|
||||
if (value()->has_child_nodes()) {
|
||||
auto node_children = MUST(object.add_array("children"sv));
|
||||
for (auto& child : children()) {
|
||||
|
||||
Reference in New Issue
Block a user