Skip to content

Feat: Add UIA trees#698

Merged
DataTriny merged 4 commits intoAccessKit:mainfrom
amerikrainian:tree-improvements
Mar 17, 2026
Merged

Feat: Add UIA trees#698
DataTriny merged 4 commits intoAccessKit:mainfrom
amerikrainian:tree-improvements

Conversation

@amerikrainian
Copy link
Contributor

@amerikrainian amerikrainian commented Mar 16, 2026

As per the title, added the expanded, collapsed, and tree view item announcements for UIA. An example to test this can be found here

Feedback welcome!

Closes #32

@amerikrainian amerikrainian changed the title Feat: Add UIA trees (#32) Feat: Add UIA trees Mar 16, 2026
Copy link
Member

@DataTriny DataTriny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @amerikrainian, thanks for that. Looks good already. Just a few requests to align with Chromium.

@amerikrainian amerikrainian requested a review from DataTriny March 17, 2026 00:33
@DataTriny
Copy link
Member

I've modified your example here to set size_of_set on the parent and to use active_descendant to manage focus inside the tree view.

Tested on Windows 11 with NVDA, the Narrator and JAWS.

Copy link
Member

@DataTriny DataTriny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since TreeItem nodes are not considered selection containers, they currently are not able to propagate their size_of_set property to their children. I think size_of_set_from_container needs to be generalized anyway to also work on nested lists in paragraphs. Here's how I'd do it:

diff --git a/consumer/src/node.rs b/consumer/src/node.rs
index cdd36cf..ff0b06a 100644
--- a/consumer/src/node.rs
+++ b/consumer/src/node.rs
@@ -609,8 +609,15 @@ impl<'a> Node<'a> {
         &self,
         filter: &impl Fn(&Node) -> FilterResult,
     ) -> Option<usize> {
-        self.selection_container(filter)
-            .and_then(|c| c.size_of_set())
+        let mut parent = self.filtered_parent(filter);
+        while let Some(p) = parent {
+            if let Some(size_of_set) = p.size_of_set() {
+                return Some(size_of_set);
+            } else {
+                parent = p.filtered_parent(filter);
+            }
+        }
+        None
     }

     pub fn size_of_set(&self) -> Option<usize> {

@DataTriny
Copy link
Member

Also please don't forget to run cargo fmt on your changes. Code formatting will be enforced by the CI once I trigger it for you.

@amerikrainian amerikrainian requested a review from DataTriny March 17, 2026 22:21
Copy link
Member

@DataTriny DataTriny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulation on your first pull request here! Thanks!

@DataTriny DataTriny merged commit 1d3b189 into AccessKit:main Mar 17, 2026
18 checks passed
@DataTriny DataTriny mentioned this pull request Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add UIA support for tree views

2 participants