Skip to content

Commit

Permalink
feat: Add role for terminals (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcampbell authored Aug 27, 2023
1 parent fc6c4e0 commit ddbef37
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ pub enum Role {
/// `TableView` and its subclasses, so they can be exposed correctly
/// on certain platforms.
ListGrid,

/// This is just like a multi-line document, but signals that assistive
/// technologies should implement behavior specific to a VT-100-style
/// terminal.
Terminal,
}

impl Default for Role {
Expand Down
2 changes: 1 addition & 1 deletion consumer/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ impl<'a> Node<'a> {
pub fn supports_text_ranges(&self) -> bool {
matches!(
self.role(),
Role::StaticText | Role::TextField | Role::Document | Role::SpinButton
Role::StaticText | Role::TextField | Role::Document | Role::SpinButton | Role::Terminal
) && self.inline_text_boxes().next().is_some()
}

Expand Down
1 change: 1 addition & 0 deletions platforms/macos/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ fn ns_role(node_state: &NodeState) -> &'static NSString {
Role::DocTip => NSAccessibilityGroupRole,
Role::DocToc => NSAccessibilityGroupRole,
Role::ListGrid => NSAccessibilityUnknownRole,
Role::Terminal => NSAccessibilityTextAreaRole,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions platforms/unix/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ impl<'a> NodeWrapper<'a> {
// TODO: Are there special cases to consider?
Role::Presentation | Role::Unknown => AtspiRole::Unknown,
Role::ImeCandidate | Role::Keyboard => AtspiRole::RedundantObject,
Role::Terminal => AtspiRole::Terminal,
}
}

Expand Down
2 changes: 1 addition & 1 deletion platforms/windows/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl<'a> NodeWrapper<'a> {
Role::Dialog => UIA_PaneControlTypeId,
Role::Directory => UIA_ListControlTypeId,
Role::DisclosureTriangle => UIA_ButtonControlTypeId,
Role::Document => UIA_DocumentControlTypeId,
Role::Document | Role::Terminal => UIA_DocumentControlTypeId,
Role::EmbeddedObject => UIA_PaneControlTypeId,
Role::Emphasis => UIA_TextControlTypeId,
Role::Feed => UIA_GroupControlTypeId,
Expand Down

0 comments on commit ddbef37

Please sign in to comment.