Skip to content

layout: Improvements to a11y update counters, and some extra tests - #46589

Merged
mrobinson merged 3 commits into
servo:mainfrom
alice:accessibility-update-counters-and-extra-tests
Jul 19, 2026
Merged

layout: Improvements to a11y update counters, and some extra tests#46589
mrobinson merged 3 commits into
servo:mainfrom
alice:accessibility-update-counters-and-extra-tests

Conversation

@alice

@alice alice commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Note: this is a bit of a grab-bag of changes. Happy to split it out if necessary.

Improvements:

  • Order counters above rooted_nodes in AccesibilityUpdate, and add a doc comment.
  • Fix a bug in computing the number of changed nodes in an update:
    • A node may be both changed and removed in a single update, which causes it to be tracked in changed_nodes, but we filter out removed nodes from the update (in fact, including them would cause a panic). The counter needs to track the number of nodes actually sent in the update.
    • Future work could avoid updating removed nodes at all, but that's out of scope here.
  • Rename fields in AccessibilityUpdateResult to remove redundant accessibility, making tests easier to read

New tests:

  • Add accessibility-update-partial-subtree-move-and-delete.html to match the existing test_accessibility_partial_subtree_move_and_delete in accessibility.rs
  • Add test_accessibility_children_of_heading_change and test_accessibility_descendants_of_heading_change, and matching servo-wpt tests accessibility-update-children-of-heading-change.html and accessibility-update-descendants-of-heading-change.html to test that changing the subtree of a heading automatically causes its label to be recomputed.

Testing: Existing and new tests pass.
Fixes: part of #46346

alice added 3 commits July 17, 2026 10:46
The new test copies the test case in `test_accessibility_partial_subtree_move_and_delete()` in `components/servo/tests/accessibility.rs`, with a complex sequence of nested subtree moves and deletes intended to exercise the incremental update code.

This test revealed an issue with computing the `accessibilityNodeInTreeUpdate` counter - a node can be both updated and removed in a single tree update, but removed nodes aren't included in the `TreeUpdate`. This is addressed by first dropping removed nodes, then filtering the list of updated nodes, then counting the filtered list for the final counter.

Future work might be to avoid updating nodes which will end up being removed from the tree in the first place - the test notes that we are updating the removed node redundantly.

Signed-off-by: Alice Boxhall <alice@igalia.com>
These tests assert that changing the subtree structure of a heading will cause the heading's label to be recomputed.

Signed-off-by: Alice Boxhall <alice@igalia.com>
Signed-off-by: Alice Boxhall <alice@igalia.com>
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jul 17, 2026
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Jul 19, 2026
@mrobinson
mrobinson added this pull request to the merge queue Jul 19, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jul 19, 2026
Merged via the queue into servo:main with commit 2152828 Jul 19, 2026
35 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jul 19, 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.

3 participants