mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-24 08:59:50 +00: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
Notes:
github-actions[bot]
2025-10-20 09:52:31 +00:00
Author: https://github.com/AtkinsSJ
Commit: c9811af3b5
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6462
Reviewed-by: https://github.com/trflynn89
1 changed files with 4 additions and 2 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue