瀏覽代碼

LibWebView: Display Accessible Name and Description

The accessibility tab now displays elements' names and descriptions
along with the role.
Jonah 2 年之前
父節點
當前提交
2f4c463920
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      Userland/Libraries/LibWebView/AccessibilityTreeModel.cpp

+ 4 - 0
Userland/Libraries/LibWebView/AccessibilityTreeModel.cpp

@@ -93,8 +93,12 @@ GUI::Variant AccessibilityTreeModel::data(GUI::ModelIndex const& index, GUI::Mod
         if (type != "element")
             return node_role;
 
+        auto name = node.get_deprecated_string("name"sv).value();
+        auto description = node.get_deprecated_string("description"sv).value();
+
         StringBuilder builder;
         builder.append(node_role.to_lowercase());
+        builder.appendff(" name: \"{}\", description: \"{}\"", name, description);
         return builder.to_deprecated_string();
     }
     return {};