MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / interactive_accessibility_node

Function interactive_accessibility_node

packages/server/src/accessibility.rs:73–97  ·  view source on GitHub ↗
(node: &Value)

Source from the content-addressed store, hash-verified

71}
72
73fn interactive_accessibility_node(node: &Value) -> Option<Value> {
74 let object = node.as_object()?;
75 let children = node
76 .get("children")
77 .and_then(Value::as_array)
78 .map(|children| {
79 children
80 .iter()
81 .filter_map(interactive_accessibility_node)
82 .collect::<Vec<_>>()
83 })
84 .unwrap_or_default();
85
86 if !is_interactive_accessibility_node(node) && children.is_empty() {
87 return None;
88 }
89
90 let mut output = object.clone();
91 if children.is_empty() {
92 output.remove("children");
93 } else {
94 output.insert("children".to_owned(), Value::Array(children));
95 }
96 Some(Value::Object(output))
97}
98
99fn is_interactive_accessibility_node(node: &Value) -> bool {
100 if bool_field(node, &["hidden", "isHidden"]).unwrap_or(false) {

Callers

nothing calls this directly

Calls 6

is_emptyMethod · 0.80
insertMethod · 0.80
getMethod · 0.65
cloneMethod · 0.65
removeMethod · 0.65

Tested by

no test coverage detected