Repository navigation
Fix chart LabelView/TickLabelView a11y peer-subtree leaks (#162) - #644
Merged
Alexandre Zollinger Chohfi (azchohfi) merged 4 commits intoJun 26, 2026
Merged
Alexandre Zollinger Chohfi (azchohfi) merged 4 commits into
Alexandre Zollinger Chohfi (azchohfi) merged 4 commits into
Conversation
Custom PieChart LabelView and {X,Y}TickLabelView extension points wrapped
caller-supplied Elements with AccessibilityView.Raw on only the outer
wrapper, which does not reliably hide inner composite peers from assistive
tech or keyboard focus. This caused double-announcement, focusable-child
leaks, and a poor 'Slice N' accessible-name fallback.
- Add ChartLabelA11y.HideSubtreeOnMount: recursively force AccessibilityView.Raw
on every descendant FrameworkElement and clear IsTabStop on every descendant
Control (public VisualTreeHelper/AutomationProperties API only, AOT-safe).
Re-walks on Loaded to cover templated-control inner peers.
- Add opt-in 'interactive: true' overload to LabelView/XTickLabelView/
YTickLabelView (and D3Axes) that leaves caller peers intact; caller owns a11y.
- Add 'name' accessible-name projection: threads into the pie slice
ChartPointDescriptor (replacing 'Slice N' fallback) and applies AutomationName
to interactive ticks.
- Regenerate reactor.api.txt (both copies) for the new optional params.
- Add 6 unit tests + 3 selftest fixtures (peer-tree Raw/IsTabStop assertions,
interactive opt-in, name projection); negative-test verified pre-fix failures.
Co-authored-by: Copilot <[email protected]>
Alexandre Zollinger Chohfi (azchohfi)
requested a review
from Chris Anderson (codemonkeychris)
as a code owner
June 23, 2026 05:49
…me test, docs H1: reset IsHitTestVisible + IsTabStop in ElementPool.CleanElement so a control hidden inside a custom chart label can't return to the pool non-tabbable / non-hit-testable and poison the next renter. H2: key pie-label and axis-tick elements by the interactive flag so toggling it at runtime forces a remount (the subtree-hide is a mount-time side effect that an in-place update cannot undo). Adds a runtime-toggle selftest. M2: add a selftest asserting the X/Y tick name projection reaches AutomationName. M3: update charting.md.dt template + both chart skill copies for the new optional-param signatures and corrected a11y wording (subtree-Raw + interactive opt-in + name projection); recompiled charting.md. L2: reorder D3Axes params (name before interactive) to match the fluent builders. L1: XML-doc note clarifying the pie name feeds the slice descriptor (always) while the tick name only sets AutomationName. New selftests: ChartA11y_LabelViewPoolReset, ChartA11y_LabelViewInteractiveToggle, ChartA11y_TickLabelViewNameProjection. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes chart a11y issues when callers provide custom LabelView / {X,Y}TickLabelView elements by hiding the entire realized subtree (not just the wrapper) from UIA/focus by default, adding an interactive: true escape hatch, and allowing an optional name projection to keep the chart’s accessible names meaningful.
Changes:
- Added
ChartLabelA11yhelper to forceAccessibilityView.Rawacross realized descendants and clearIsTabStopfor non-interactive label/tick subtrees. - Extended chart label/tick APIs with optional
nameandinteractiveparameters, and keyed label/tick elements by the interactive flag to force remount on toggles. - Added unit + selftests, updated fixture registry, and refreshed docs/skill/API reference outputs.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Reactor.Tests/ChartsBuilderTests.cs | Unit tests for new overload storage and name-projection precedence/fallback. |
| tests/Reactor.AppTests.Host/SelfTest/SelfTestFixtureRegistry.cs | Registers new ChartA11y selftests in both required locations. |
| tests/Reactor.AppTests.Host/SelfTest/Fixtures/ChartAccessibilityFixtures.cs | Selftests validating subtree Raw/tab-stop behavior, interactive toggling, and name projection. |
| src/Reactor/Core/ElementPool.cs | Resets IsHitTestVisible and IsTabStop to avoid pool contamination from subtree hiding. |
| src/Reactor/Charting/D3Charts.cs | Adds tick name/interactive options, subtree hiding, and interactive-keyed remount behavior in D3Axes. |
| src/Reactor/Charting/Charts.cs | Threads tick options into D3Axes; adds pie name/interactive options and descriptor fallback. |
| src/Reactor/Charting/Accessibility/ChartLabelA11y.cs | New helper implementing subtree hide + focus removal (immediate + Loaded pass). |
| skills/reactor.api.txt | Regenerated API reference reflecting new method signatures. |
| skills/charts.md | Updates charting skill guidance for new defaults/parameters. |
| plugins/reactor/skills/reactor-dsl/references/reactor.api.txt | Regenerated plugin API reference reflecting new signatures. |
| plugins/reactor/skills/reactor-charts/SKILL.md | Updates packaged chart skill guidance for new defaults/parameters. |
| docs/guide/charting.md | User guide updates documenting name and interactive behavior. |
| docs/_pipeline/templates/charting.md.dt | Template updates (source-of-truth) for regenerated charting guide section. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…review) HideSubtreeOnMount attaches a one-shot Loaded handler for the deferred subtree hide. If the label element is unmounted and returned to the pool before it ever loads, that handler survives into a later reuse of the recycled FrameworkElement. When the FE is re-rented for an interactive (or unrelated) element, the stale handler would wrongly force AccessibilityView.Raw / IsTabStop=false on the new subtree. Extract the deferred arm into ChartLabelA11y.ApplyDeferredHide with a guard: only apply when IsHitTestVisible == false (the state HideSubtreeOnMount established). The H1 pool reset restores IsHitTestVisible to true on return, so a stale handler firing on a recycled/interactive FE is correctly skipped; a genuine deferred non-interactive load still applies. Adds selftest ChartA11y_LabelViewDeferredHideStaleGuard covering both arms. Co-authored-by: Copilot <[email protected]>
…entinel guard, tick tests Implements the 4 findings from the second pr-review pass on PR #644: M1 (correctness): the non-interactive label/tick subtree hide ran only at mount/Loaded, so an in-place data/content update that realized NEW focusable descendants leaked them back into UIA / the tab order. Add an internal OnUpdateAction modifier hook (the update-time counterpart to OnMountAction) fired from Reconciler.ApplyModifiers when oldM is not null (after child reconciliation), plus an internal OnUpdateAdd extension. The 3 non-interactive chart sites now wire .OnUpdateAdd(HideSubtreeOnUpdate) to re-walk and re-Raw/untab the subtree on every update. Internal-only -> no public api.txt change. M2 (alternative/test-coverage): the new Control.IsTabStop pool reset was untracked by the PoolResetSet convention. Add IsTabStop to PoolResetSetAnalyzer.TrappedProperties (it has an .IsTabStop modifier) and widen the consistency-test ClearValue regex to owner-qualified (FrameworkElement|UIElement|Control).XProperty on any receiver so it sees both the UIElement.IsHitTestVisible and Control.IsTabStop resets. IsHitTestVisible has no modifier -> documented in IntentionallyExcluded. L1 (correctness): replace the deferred-hide IsHitTestVisible identity guard with a private attached sentinel (PendingDeferredHide) set in HideSubtreeOnMount and cleared on unmount (.OnUnmountAdd(ClearPendingHide)); ApplyDeferredHide now hides only when the sentinel is present, so a pre-load unmount can't poison a recycled interactive renter. L2 (test-coverage): add TickLabelViewInteractiveToggle (X+Y tick hide + interactive remount) and LabelViewUpdateRehide (M1) selftests; rework LabelViewDeferredHideStaleGuard for the sentinel. M1 and L1 both verified red-on-revert. Shared-a11y note: only additive touch remains the pie ChartPointDescriptor _labelName fallback (from the original fix) -- watch vs concurrent #633 descriptor work. No public API change; both reactor.api.txt copies unchanged (verified by ApiIndexGeneratorTests). Co-authored-by: Copilot <[email protected]>
Alexandre Zollinger Chohfi (azchohfi)
deleted the
azchohfi-fix-chart-labelview-a11y-peers
branch
June 26, 2026 05:48
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.
Closes #162.
Problem
PieChartElement<T>.LabelView(Func<T,PieSliceLayout,Element>)andChartElement<T>.{X,Y}TickLabelView(Func<double,Element>)let callers replace the built-inTextBlockat a slice centroid / axis tick with any ReactorElement(including a customComponent). The stopgap wrapped the returned element with.AccessibilityView(Raw)+IsHitTestVisible=falseon the outer wrapper only.Rawon the outer wrapper does not reliably remove inner peers from assistive tech / focus traversal, causing:ChartPointDescriptornames the slice (e.g. "Slice 5: 12 units"); a userLabelViewcontaining the same string produces a second peer that announces it again.Button) in the user'sElementkeep their peers;IsHitTestVisible=falseblocks pointer hits but not keyboard/focus traversal of inner peers.LabelViewand skips the stringLabelAccessor/DataLabel, the slice's accessible name falls back to"Slice {i+1}"even though the visual shows a meaningful label.Fix
1. Force-Raw the whole realized subtree + remove inner focus
New helper
src/Reactor/Charting/Accessibility/ChartLabelA11y.cs:HideSubtreeOnMount(fe)setsIsHitTestVisible=falseon the outer wrapper, then walks the realized visual tree (immediately and again onLoaded, to cover templated-control inner peers that only realize after load).HideSubtree(root)recurses viaVisualTreeHelper, settingAutomationProperties.AccessibilityView = Rawon every descendantFrameworkElement(removes inner peers from the UIA Content/Control views) andIsTabStop = falseon every descendantControl(removes inner focusable children from the keyboard tab order).VisualTreeHelper/AutomationPropertiesAPI — no reflection — so it stays AOT/trim-safe (the core lib treats AOT/trim warnings as errors).2. Opt-in
interactive: trueescape hatchLabelView,XTickLabelView,YTickLabelView(andD3Charts.D3Axes) gain an optionalinteractiveparam. Whentrue, the chart does not force-Raw the subtree or remove focus — the caller takes responsibility for the element's accessibility. Default (false) = fully hidden from UIA/focus; the chart's own descriptor is the single source of truth.3.
accessibleNameprojectionLabelView/XTickLabelView/YTickLabelViewgain an optionalnameprojection. For pie slices it threads into theChartPointDescriptor(LabelAccessor?.Invoke(d) ?? _labelName?.Invoke(d) ?? "Slice {i+1}"), so the accessible name matches the visible label instead of falling back to "Slice N" when aLabelViewis supplied without aDataLabel/LabelAccessor. For ticks it appliesAutomationName.API additions are optional params (source-compatible — existing single-arg call sites compile unchanged).
reactor.api.txtregenerated (both copies).Tests
tests/Reactor.Tests/ChartsBuilderTests.cs): overload storage, name-projection threading into the descriptor, "Slice N" fallback,LabelAccessorprecedence.tests/Reactor.AppTests.Host/SelfTest/Fixtures/ChartAccessibilityFixtures.cs) that build a real PieChart / Chart with a composite-ComponentLabelViewcontaining a focusableButton+ aTextBlock, realize the peer tree, and walk the realizedFrameworkElementsubtree asserting: (a) every inner descendant isAccessibilityView.Rawand (b) every innerControlis not a tab stop for the default non-interactive case; (c) withinteractive:truethe inner peers/tab-stops are intact; (d) the slice's accessible name equals thenameprojection (not "Slice N") when supplied without aDataLabel.Peer-tree assertions are automated at the realized-FE level via the selftest tier; descriptor/name threading is verified both at the builder seam (unit) and via a realized
ChartAutomationPeer(selftest).Build clean (core lib + tests, ARM64), all unit + ChartA11y selftests green.
Coordination note (charting a11y is churning)
Per issue #162, charting a11y is actively churning (#628/#629 A11Y_CHART_011, #633 active-background scope, #498 charting↔scanner decoupling). This PR keeps changes scoped to the LabelView/TickLabelView peer-subtree + accessibleName paths. The only shared a11y touch is threading
_labelNameinto the existing pieChartPointDescriptorconstruction inCharts.cs(one line, additive fallback) — flagging for merge ordering with any concurrent descriptor/scanner work.Co-authored-by: Copilot [email protected]
Review triage (pr-review follow-up)
Applied the coordinator-triaged pr-review findings on top of the original fix:
IsTabStop=false/IsHitTestVisible=falseon poolable inner controls.ElementPool.CleanElementnowClearValuesUIElement.IsHitTestVisiblePropertyand (guarded)Control.IsTabStopPropertynext to the existingAccessibilityViewreset, so a hidden inner control can't return to the pool non-tabbable / non-hit-testable and poison the next unrelated renter. New selftestChartA11y_LabelViewPoolResetrents → sets both false + Raw → returns → re-rents the same instance and asserts all three reset.interactivein place couldn't undo it. Pie-label and axis-tick elements are now keyed by the interactive flag (__pielabel{i}_{0|1},__xtick{i}_{0|1},__ytick{i}_{0|1}), so toggling forces a remount that re-runs (or skips) the hide. New selftestChartA11y_LabelViewInteractiveToggletoggles at runtime and asserts peers/tab-stops hide → un-hide → re-hide. (Relies on the H1 pool reset for the recycled control to come back clean.)ChartA11y_TickLabelViewNameProjectionexercises bothXTickLabelView/YTickLabelViewname projections and asserts the value reachesAutomationNameon the realized tick element.charting.md.dttemplate signature table + a11y wording (subtree-Raw + interactive opt-in + name projection) and both chart skill copies (skills/charts.md,plugins/reactor/skills/reactor-charts/SKILL.md); recompiledcharting.md.D3Axesparams (namebeforeinteractive) to match the fluent builders.namefeeds the slice descriptor (always) while the ticknameonly setsAutomationName(intentional asymmetry).Merge-ordering: the only shared-a11y touch remains the additive
_labelNamefallback in the pieChartPointDescriptor— keep an eye on concurrent #633 descriptor work.All ChartA11y selftests (incl. 3 new),
ElementPoolOptionalResetselftests, andPoolResetSetConsistencyTests+ChartsBuilderTests+ApiIndexGeneratorTestsunit tests green; core lib + host build clean (ARM64); bothreactor.api.txtcopies identical and current.Re-review follow-up (2nd pr-review pass)
Implemented the 4 findings from the second pr-review run (0 critical, 0 high, 2 medium, 2 low):
Loaded, so a later in-place data/content update that realized new focusable descendants leaked them back into UIA / the tab order. Added an internalOnUpdateActionmodifier hook (the update-time counterpart toOnMountAction) fired fromReconciler.ApplyModifierswhenoldM is not null— i.e. on every in-place update, after child reconciliation — plus an internalOnUpdateAddextension. The 3 non-interactive chart sites now wire.OnUpdateAdd(HideSubtreeOnUpdate)to re-walk and re-Raw/untab the subtree. Internal-only ⇒ no public API change. New selftestChartA11y_LabelViewUpdateRehidegrows a label fromVStack(TextBlock)toVStack(TextBlock, Button)on a state toggle (stable key ⇒ in-place update) and asserts the update-realized buttons areRaw+ not tab stops. Verified red-on-revert (buttons still mount but leak when the hook is disabled).IsTabStopin the pool-reset convention. The newControl.IsTabStoppool reset was invisible toPoolResetSetAnalyzer/PoolResetSetConsistencyTests. AddedIsTabStoptoTrappedProperties(it has an.IsTabStopmodifier) and widened the consistency-testClearValueregex to owner-qualified(FrameworkElement|UIElement|Control).XPropertyon any receiver, so it now sees both theUIElement.IsHitTestVisibleandControl.IsTabStopresets (the allow-list deliberately keepsAutomationProperties.*/FlexPanel.*attached-property clears excluded).IsHitTestVisiblehas no modifier → documented inIntentionallyExcluded. The table-driven analyzer test auto-coversIsTabStop.Loadedarm'sIsHitTestVisibleidentity guard (which mis-fired on a recycled element that merely carriedIsHitTestVisible=false) with a private attachedPendingDeferredHidesentinel set inHideSubtreeOnMountand cleared on unmount via.OnUnmountAdd(ClearPendingHide)(Charting-side, to avoid a Core→Charting layering dependency).ApplyDeferredHidenow hides only when the sentinel is present and consumes it. ReworkedChartA11y_LabelViewDeferredHideStaleGuardto cover no-sentinel-skips / sentinel-applies / cleared-skips. Verified red-on-revert (old guard fails 6/7 cases).ChartA11y_TickLabelViewInteractiveToggleexercises the previously-uncovered Y-tick hide branch and the tick remount-by-interactivekey for both axes (hide → expose → hide).Shared-a11y note (merge ordering): unchanged from above — the only shared touch remains the additive
_labelNamefallback in the pieChartPointDescriptor; watch vs concurrent #633 descriptor work. No public surface change; bothreactor.api.txtcopies unchanged (verified byApiIndexGeneratorTests). Full unit suite (9523),PoolResetSet(28), and all ChartA11y selftests green; core lib + host build clean (ARM64, 0 warnings).