Skip to content

Virtual lists and grids: a heading row counts as an item, an item's set size replaces its row's, and no row or column index #533

Done

Description

@wmfeht

Context: we're doing preliminary work on porting Strata (lgse/strata) from GTK 4 to Rune. Its
list, icon and table views are virtual rows (virtual_rows) with section headings, tiles packed
several to a row, and table cells.

What's missing (5d421fd, unchanged at 29aacb6):

  1. Every mounted virtual row gets its list index as its position (a11y/tree.rs:397), so a
    heading among options reads as an item ("12 of 20").
  2. Nothing relates items to the heading above them (AccessKit's member_of, ARIA
    aria-owns), so a screen reader never hears the group it enters.
  3. El::position_in_set(i, n) on an item sets n as the size of set of the element holding it
    (a11y/tree.rs:340, applied at :398), overriding the row's own place among the rows.
  4. AccessKit has row_count, column_count, row_index and column_index; no El builder
    sets them, so "row 50,000 of 100,000, column C" can't be said.

Repro (headless; ran at 5d421fd and 2a44156):

use rune::{Cx, El, Env, GrowthSpec, Runtime, ScrollSpec, col, row, text};
fn grouped(_: &(), _: &mut Cx<()>) -> El {
    col().size(300.0, 600.0).scroll(ScrollSpec { stick_bottom: false }).child(
        col().key("list").role("listbox").label("Files").growth(GrowthSpec::default())
            .virtual_rows(20, 24.0, |_: &(), i| format!("r{i}").into(), |_: &(), i| {
                if i == 0 || i == 11 { text(format!("Group {i}")).h(24.0).role("heading") }
                else { text(format!("Item {i}")).h(24.0).role("option") }
            }))
}
fn grid(_: &(), _: &mut Cx<()>) -> El {
    col().size(600.0, 300.0).scroll(ScrollSpec { stick_bottom: false }).child(
        col().key("grid").role("grid").label("Icons").growth(GrowthSpec::default())
            .virtual_rows(5, 30.0, |_: &(), i| format!("line{i}").into(), |_: &(), i| {
                row().h(30.0).role("row").children((0..8).map(move |c| text(format!("tile {}", i * 8 + c)).role("gridcell").position_in_set(i * 8 + c + 1, 40)))
            }))
}
fn show(name: &str, view: fn(&(), &mut Cx<()>) -> El, roles: &[&str]) {
    let mut rt = Runtime::new((), view, (600.0, 600.0), Env::new(true, 1.0));
    rt.frame(0.0);
    rt.frame(0.016);
    println!("{name}:");
    let mut stack = vec![rt.accessibility_json()];
    while let Some(mut n) = stack.pop() {
        if let Some(kids) = n.get_mut("children").map(serde_json::Value::take) {
            stack.extend(kids.as_array().into_iter().flatten().rev().cloned());
        }
        if n.get("role").and_then(|r| r.as_str()).is_some_and(|r| roles.contains(&r)) {
            println!("  {} {} position {} setSize {}", n["role"], n["name"], n["position"], n["setSize"]);
        }
    }
}
fn main() {
    show("headings among options", grouped, &["heading"]);
    show("grid of rows of cells", grid, &["grid", "row"]);
}

Output:

headings among options:
  "heading" "Group 0" position 1 setSize null
  "heading" "Group 11" position 12 setSize null
grid of rows of cells:
  "grid" "Icons" position null setSize 5
  "row" "tile 0 tile 1 tile 2 tile 3 tile 4 tile 5 tile 6 tile 7" position 1 setSize 40
  "row" "tile 8 tile 9 tile 10 tile 11 tile 12 tile 13 tile 14 tile 15" position 2 setSize 40
  "row" "tile 16 tile 17 tile 18 tile 19 tile 20 tile 21 tile 22 tile 23" position 3 setSize 40
  "row" "tile 24 tile 25 tile 26 tile 27 tile 28 tile 29 tile 30 tile 31" position 4 setSize 40
  "row" "tile 32 tile 33 tile 34 tile 35 tile 36 tile 37 tile 38 tile 39" position 5 setSize 40

Ask.

  1. A way for a virtual row to take no position and not count (a heading).
  2. An El builder naming the element (by key) a row belongs to.
  3. Keep a container's size of set to its own set; give the items' size to the container as
    a count of its children where its role has one.
  4. El::column_index(i), El::row_index(i), and El::grid_size(rows, cols) (or counts on
    grid and table), mapped to AccessKit's.

Related: #111 (WCAG audit on desktop).

Activity

  1. osmelmora commented on Nov 20, 2026

    @osmelmora

    One more case for item 3, from a tree, and an AccessKit detail that affects the fix.

    Use case. We're building headless widget behaviors on Rune core, outside rune-kit. Our tree is one focusable host over virtual_rows, so its rows are one flat list with El::level on each. Rows at different levels belong to different sets. "Fruits" is 1 of 2, and its child "Apple" is 1 of 3. Each row says so with position_in_set, but every size lands on the tree element, and the last mounted row's size wins. A reader hears every row as "of 2".

    Repro (headless; ran at eff95e8 on dev):

    use rune::{Cx, El, Env, Runtime, col, el, text};
    
    struct S;
    
    // Fruits (1 of 2) > Apple, Banana, Cherry (1, 2, 3 of 3); Vegetables (2 of 2). One flat list of rows.
    const ROWS: [(&str, u32, usize, usize); 5] =
        [("fruits", 1, 1, 2), ("apple", 2, 1, 3), ("banana", 2, 2, 3), ("cherry", 2, 3, 3), ("vegetables", 1, 2, 2)];
    
    fn view(_: &S, _: &mut Cx<S>) -> El {
        col().key("tree").role("tree").label("Food").children(ROWS.iter().map(|&(key, level, pos, size)| {
            el().key(key)
                .role("treeitem")
                .label(key)
                .focusable(true)
                .level(level)
                .position_in_set(pos, size)
                .size(140.0, 20.0)
                .child(text(key))
        }))
    }
    
    fn find<'a>(n: &'a serde_json::Value, key: &str) -> Option<&'a serde_json::Value> {
        if n["key"] == key {
            return Some(n);
        }
        n["children"].as_array()?.iter().find_map(|c| find(c, key))
    }
    
    fn main() {
        let mut rt = Runtime::new(S, view, (300.0, 200.0), Env::default());
        rt.frame(0.0);
        let a11y = rt.accessibility_json();
        let tree = find(&a11y, "tree").unwrap();
        println!("tree: setSize {}", tree["setSize"]);
        for (key, _, pos, size) in ROWS {
            let n = find(&a11y, key).unwrap();
            println!("{key:<11} wants {pos} of {size}: level {} position {} setSize {}", n["level"], n["position"], n["setSize"]);
        }
    }

    Output:

    tree: setSize 2
    fruits      wants 1 of 2: level 1 position 1 setSize null
    apple       wants 1 of 3: level 2 position 1 setSize null
    banana      wants 2 of 3: level 2 position 2 setSize null
    cherry      wants 3 of 3: level 2 position 3 setSize null
    vegetables  wants 2 of 2: level 1 position 2 setSize null
    

    AccessKit reads set size only from a container. So putting the size on each row wouldn't be enough by itself. The Windows and AT-SPI adapters report an item's set size as its nearest ancestor's (size_of_set_from_container, accesskit_consumer 0.39.2 src/node.rs:633). They call it from vendor/accesskit_windows/src/node.rs:692 and accesskit_atspi_common 0.21.1 src/node.rs:401, and never read the item's own size_of_set. AccessKit's main is the same, and its macOS adapter reports no set size at all.

    So per-level sizes in a flat tree need one of these:

    • Rune nests the AccessKit tree by level, so the rows under one parent row sit in a group node that carries their set size, as in a nested tree.
    • AccessKit reads an item's own size_of_set before its container's, and Rune keeps the size on the item.

    Until then our tree reports per-level set size as unsupported.

  2. Hona commented on Nov 24, 2026

    @Hona
    Member

    Landed the parts settled by the WAI-ARIA 1.2 specification and Chromium's accessibility tree in #1798 (e565a1e on dev), and leaving this issue open for the two design items below.

    Under WAI-ARIA 1.2 (aria-posinset, aria-setsize, aria-rowcount, aria-colcount, aria-rowindex, aria-colindex) and Chromium (ui/accessibility/ax_role_properties.cc IsItemLike/IsSetLike/IsTableLike, ui/accessibility/ax_node.cc IsOrderedSetItem, ui/accessibility/ax_tree.cc ComputeSetSizePosInSetAndCache), headings and other non-item roles never receive set positions, grid/table/row/gridcell use row/column counts and indices rather than set sizes, and a container's set size tracks its shallowest hierarchical level.

    Done in #1798 (e565a1e):

    • Non-item virtual rows (item 1): virtual_rows now auto-assigns position_in_set only to ordered-set item roles (listitem, option, treeitem, menuitem*, tab, radio, article, and row inside an ordered-set container), so heading rows take no position. Setting El::position_in_set(pos, total_items) on the items sets both their positions and the container's size_of_set, excluding headings.
    • Container set_size scoping (item 3, grid/row & top-level tree): El::position_in_set now propagates size_of_set only to ordered-set containers (never row, grid, table, or window), and deeper level items in a flat tree no longer overwrite the top level's set size on the tree node.
    • Grid/table counts and indices (item 4): added El::row_count, El::column_count, El::row_index, and El::column_index (1-based on El and accessibility_json's rowCount/columnCount/rowIndex/columnIndex, 0-based on AccessKit Node). A virtual_rows container with role grid or table populates row_count and row row_index instead of size_of_set/position_in_set unless overridden. Note that AccessKit 0.25.2's platform adapters do not yet expose row_count/column_count/row_index/column_index to UIA/AT-SPI/NSAccessibility; Rune populates the AccessKit nodes so adapters will pick them up once supported.

    Still open:

    • Group membership across flat virtual rows (item 2): WAI-ARIA models grouped options with role="group" containers rather than linking options to headings (there is no aria-memberof), AccessKit 0.25.2's platform adapters ignore Node::member_of and Node::owns, and a key reference to a heading row breaks once the heading scrolls out of the mounted window. How Rune should model virtualized option groups remains an open design choice.
    • Per-level set sizes in a flat native tree (item 3 comment): as noted above, accesskit_consumer 0.39.2 (size_of_set_from_container) reads size_of_set only from ancestor containers and never from the item itself, so per-level set sizes on flat treeitem siblings still need either upstream AccessKit support or synthetic nested group nodes in crates/rune/src/a11y/tree.rs.
  3. Hona commented on Nov 24, 2026

    @Hona
    Member

    The set-size, heading-position, and grid index defects reported here are now fixed on dev, and the remaining feature requests live in dedicated issues below:

    These changes were verified with headless tree and adapter unit tests (and a Linux compile check); no live screen reader was run, and accesskit_macos does not expose set sizes yet.

    What remains is tracked separately:

    If any of the fixed cases still reproduce on current dev, please reopen with a repro on 8a54a0a or later. Thanks for the detailed repros!

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