Repository navigation
fix(atspi): report removed and added children in children-changed signals - #22398
Conversation
NuGet packagesThe packages for this pull request have been published (workflow run):
|
…nals - Send one remove per child that leaves, with its old index, before detaching it. - Send one add per child that arrives, with its new index. - Stop sending an add that names the parent as its own child. - Send nothing for nodes whose children no client has read. - Add unit tests for the child list comparison. Fixes AvaloniaUI#22397 Co-authored-by: Renaud Lepage <387759+cybik@users.noreply.github.com>
b387bc8 to
c8f728e
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The implementation matches the AT-SPI change contract and includes focused regression coverage.
0 open findings
What changed in this PR
Fixes AT-SPI child-change notifications so accessibility clients receive accurate removals, additions, indices, and child references.
Changes:
- Adds ordered child-list diffing and correct AT-SPI signal emission.
- Preserves lazy initialization when children have not been queried.
- Adds regression tests and required test-project access.
| File | Description |
|---|---|
src/Avalonia.FreeDesktop.AtSpi/AtSpiNode.cs |
Implements child diffing and signal emission. |
src/Avalonia.FreeDesktop.AtSpi/Avalonia.FreeDesktop.AtSpi.csproj |
Exposes internals to the test assembly. |
tests/Avalonia.Controls.UnitTests/Automation/AtSpiChildrenDiffTests.cs |
Tests replacements, insertions, removals, moves, and ordering. |
tests/Avalonia.Controls.UnitTests/Avalonia.Controls.UnitTests.csproj |
References the AT-SPI project for testing. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
|
@glennawatson Sorry this took a while, had a lot at hand atm 😓 Thanks for the contribution! |
|
|
@cla-avalonia agree |
|
@jmacato all good. Just glad to help you guys out. |
|
@jmacato not sure why the build queue failed. Merge issue? |
|
@glennawatson seems to be flakey test, will add again |
…nals (#22398) - Send one remove per child that leaves, with its old index, before detaching it. - Send one add per child that arrives, with its new index. - Stop sending an add that names the parent as its own child. - Send nothing for nodes whose children no client has read. - Add unit tests for the child list comparison. Fixes #22397 Co-authored-by: Renaud Lepage <387759+cybik@users.noreply.github.com> Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
What does the pull request do?
Sends correct AT-SPI
children-changedsignals when a control's children change inside a window. See #22397.Credit for this PR goes out to @cybik -- they reached out to me on LinkedIn after seeing the other AT-SPI based work I been doing in Avalonia and asked me to confirm if I saw the same issue.
What is the current behavior?
When a template selector swaps a pane, the bridge sends
children-changed:addtwice at index 0, and each names the parent as its own child. It never sendsremovefor the old pane and never names the new one. Screen readers such as Orca are left with a wrong view of the tree.What is the updated/expected behavior with this PR?
Each child that leaves gets one
removewith its old index and reference. Each child that arrives gets oneaddwith its new index and reference.Run the single-file app in #22397 against this branch. Each switch now reports:
How was the solution implemented (if it's not obvious)?
OnPeerChildrenChangedrebuilds the child list and compares it with the old one.EnsureChildrenuses the same code without sending signals.removeis sent before the child is detached. After that, its reference becomes the null reference.add.Unit tests cover the comparison: replace, add, remove, move, and that applying the reported changes in order produces the new list. The D-Bus path needs a real accessibility bus, so I checked it with the repro in #22397 on a private Xvfb display and accessibility bus. The test project gets the same
InternalsVisibleToand project reference as #22383.Checklist
Breaking changes
None.
Obsoletions / Deprecations
None.
Fixed issues
Fixes #22397