Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions adapters/macos/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,17 @@ fn ns_role(node: &NodeRef) -> &'static NSAccessibilityRole {
}
}

fn label_is_exposed_in_value(role: Role) -> bool {
matches!(
role,
Role::Label
| Role::ListBoxOption
| Role::ListMarker
| Role::MenuListOption
| Role::TitleBar
)
}

fn ns_sub_role(node: &NodeRef) -> &'static NSAccessibilitySubrole {
let role = node.role();

Expand Down Expand Up @@ -309,6 +320,9 @@ impl NodeWrapper<'_> {
// includes a title, VoiceOver behavior is broken.
return None;
}
if label_is_exposed_in_value(self.0.role()) {
return None;
}
self.0.label()
}

Expand All @@ -329,6 +343,11 @@ impl NodeWrapper<'_> {
// Also, `Node::is_selected` is mapped to checked via `accessibilityValue`.
return Some(Value::Bool(self.0.is_selected().unwrap_or(false)));
}
if label_is_exposed_in_value(self.0.role()) {
if let Some(label) = self.0.label() {
return Some(Value::String(label));
}
}
if let Some(value) = self.0.value() {
return Some(Value::String(value));
}
Expand Down
Loading