LearnNewsExamplesServices
Frontmatter
id9431
titleTreeStore: Fix ARIA desync (siblingIndex and siblingCount) after sort and filter
stateClosed
labels
bugaiarchitecturegrid
assigneestobiu
createdAtMar 10, 2026, 3:26 PM
updatedAtMar 10, 2026, 4:02 PM
githubUrlhttps://github.com/neomjs/neo/issues/9431
authortobiu
commentsCount1
parentIssue9404
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMar 10, 2026, 4:02 PM

TreeStore: Fix ARIA desync (siblingIndex and siblingCount) after sort and filter

Closed v12.1.0 bugaiarchitecturegrid
tobiu
tobiu commented on Mar 10, 2026, 3:26 PM

Goal

Ensure siblingIndex and siblingCount are accurately recalculated when the TreeStore is sorted or filtered.

Context

Currently, TreeStore.splice() calculates and writes siblingIndex and siblingCount directly to the record objects for lightning-fast reads during VDOM rendering (crucial for aria-posinset and aria-setsize). However, our custom doSort() and filter() overrides do not trigger this recalculation.

  • After sorting, the visual order changes, but screen readers read the old index order.
  • After filtering, the visual count of siblings decreases, but screen readers announce the pre-filtered count.

Acceptance Criteria

  • Ensure updateSiblingStats() (or a variant) is called appropriately after sorting to update the indices of siblings.
  • Ensure updateSiblingStats() (or a variant) is called after filtering so the sibling count strictly reflects only the visible siblings.
  • Write unit tests in TreeStore.spec.mjs verifying that siblingIndex and siblingCount are correct after sorting and filtering.
  • Ensure the fix remains performant and doesn't break Turbo Mode.

Implementation Guidance for Future Sessions: You can reuse the testing environment in test/playwright/unit/data/TreeStore.spec.mjs. Be aware that updating stats during filtering might require distinguishing between the structural sibling count (in #childrenMap) and the filtered sibling count.

tobiu added the bug label on Mar 10, 2026, 3:26 PM
tobiu added the ai label on Mar 10, 2026, 3:26 PM
tobiu added the architecture label on Mar 10, 2026, 3:26 PM
tobiu added the grid label on Mar 10, 2026, 3:26 PM
tobiu added parent issue #9404 on Mar 10, 2026, 3:26 PM
tobiu assigned to @tobiu on Mar 10, 2026, 3:29 PM
tobiu referenced in commit efe0bb5 - "TreeStore: Fix ARIA desync (siblingIndex and siblingCount) after sort and filter (#9431)" on Mar 10, 2026, 4:01 PM
tobiu
tobiu Mar 10, 2026, 4:01 PM

Input from Gemini 3.1 Pro:

✦ The ARIA desync issue (#9431) has been fixed!

I've updated doSort() and filter() in TreeStore.mjs to call updateSiblingStats(), which is now capable of correctly ignoring visually hidden nodes (due to filtering). childCount, siblingCount, and siblingIndex are all properly managed. The tests have also been updated to ensure coverage and no regressions. I've pushed the changes to the dev branch.

tobiu closed this issue on Mar 10, 2026, 4:02 PM