Skip to content

Allow item-level size_of_set to override container size_of_set for flat trees #875

Backlog

Description

@Hona

Problem

In a virtualized flat tree (a Role::Tree whose Role::TreeItem rows are direct children distinguished by Node::level and Node::position_in_set), sibling sets at different levels have different sizes. For example:

  • fruits (level 1, position 1 of 2)
    • apple (level 2, position 1 of 3)
    • banana (level 2, position 2 of 3)
    • cherry (level 2, position 3 of 3)
  • vegetables (level 1, position 2 of 2)

Because accesskit_windows (src/node.rs, NodeWrapper::size_of_set) and accesskit_atspi_common (src/node.rs, NodeWrapper::size_of_set) only call size_of_set_from_container(&filter) and never read Node::size_of_set on the item itself, cherry inherits the Role::Tree container's size_of_set (2) and is reported to UIA and AT-SPI as "3 of 2" (violating position_in_set < size_of_set).

Synthesizing unlabelled Role::Group wrappers by level is not transparent in AccessKit because size_of_set_from_container(&filter) requires ancestors to pass common_filter, which also makes Role::Group navigable on Windows UIA (IsControlElement / IsContentElement = true), macOS (AXApplicationGroup), and AT-SPI (AtspiRole::Panel).

What Chromium does

For flat ARIA trees using aria-level, aria-posinset, and aria-setsize, Chromium keeps treeitem nodes as direct children of role="tree" and reports each item's own hierarchical level setsize directly on the treeitem (ui/accessibility/ax_tree.cc, AXTree::ComputeSetSizePosInSetAndCache).

Suggested change

Check an item's own size_of_set on item roles before falling back to size_of_set_from_container(&filter) (gating to item roles so containers like Tree, ListBox, and Group never report their children's count as their own sibling set size):

// accesskit_windows/src/node.rs (and identically in accesskit_atspi_common/src/node.rs)
(self.node.is_item_like() || self.node.role() == Role::Row)
    .then(|| self.node.size_of_set())
    .flatten()
    .or_else(|| self.node.size_of_set_from_container(&filter))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions