Fix macOS AXLayoutChanged notifications dropped for template-internal peers - #21595
Merged
Conversation
|
You can test this PR using the following package version. |
The changed peer is usually a template-internal layout container that AppKit will not deliver notifications for; post on its templated parent (the owning control), falling back to the nearest exposed ancestor when there is none.
jmacato
force-pushed
the
fix/macos-ax-layoutchanged-notification
branch
from
June 16, 2026 14:27
e8d2860 to
b89f8bc
Compare
|
You can test this PR using the following package version. |
MrJul
enabled auto-merge
June 16, 2026 15:52
MrJul
added this pull request to the merge queue
Jun 16, 2026
|
You can test this PR using the following package version. |
MrJul
pushed a commit
to MrJul/Avalonia
that referenced
this pull request
Jun 23, 2026
… peers (AvaloniaUI#21595) * Post macOS AXLayoutChanged on the changed peer's templated parent The changed peer is usually a template-internal layout container that AppKit will not deliver notifications for; post on its templated parent (the owning control), falling back to the nearest exposed ancestor when there is none. * Update with comment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
Makes macOS deliver
AXLayoutChangedto assistive technologies when a control's children change (e.g. expanding an Expander).What is the current behavior?
raiseChildrenChangedposts the notification onself, but the peer that changes is usually a template-internal layout container (the Expander'sDockPanelroot,VisualLayerManager, etc.) whoseisAccessibilityElementisNO. AppKit silently drops notifications posted on non-accessibility elements, so AX clients never see the new subtree until they re-navigate.What is the updated/expected behavior with this PR?
The notification is posted on the changed peer's templated parent (the control that owns the template), which is an accessibility element. Verified with an out-of-process
AXObserveron the application element: expanding an Expander raised zero layout notifications before, and arrives after (re-targeted from theDockPanelto the owningExpander).How was the solution implemented (if it's not obvious)?
AvnAutomationPeerexposesGetTemplatedParent()(the owning control's peer, resolved fromTemplatedParent), andraiseChildrenChangedposts on it, jumping straight past the template's internal containers. Elements with no templated parent (e.g. overlay layers) fall back to walking up to the nearest exposed ancestor.Breaking changes
None.