mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01: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:
parent
d5fe7f7a98
commit
c9811af3b5
|
|
@ -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()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user