Skip to content

docs(specs): 026 charting accessibility design - #52

Merged
Chris Anderson (codemonkeychris) merged 2 commits into
mainfrom
docs/charting-a11y-spec
Apr 20, 2026
Merged

Chris Anderson (codemonkeychris) merged 2 commits into
mainfrom
docs/charting-a11y-spec

Conversation

@codemonkeychris

Copy link
Copy Markdown
Collaborator

Summary

  • Adds docs/specs/026-charting-accessibility-design.md — design spec targeting an "A" grade on charting accessibility: WCAG 2.2 AA out of the box, keyboard / screen-reader / forced-colors / reduced-motion on par with Highcharts and Power BI.
  • Eight-layer architecture: UIA ChartAutomationPeer with IGridProvider mapping → accessor-driven labels + ChartSummarizer → app-supplied .AlternateView() toggle → ChartKeyboardNavigator (virtual focus, standard bindings) → viewport + overlay focus context → debounced polite live region → forced-colors + reduced-motion + palette customization (Tier 1 curated / Tier 3 scanner-validated / Tier 4 escape hatch + ChartPalette.Harden utility) → scanner rules A11Y_CHART_001–012.
  • Three-phase rollout, ~10 weeks. Grading rubric with 11 checkboxes for per-chart scoring.
  • Explicit out-of-scope: sonification (deferred), framework-owned data-table fallback (recast as app-level per reviewer feedback).

Related: spec 006 (accessibility system), spec 016 (native chart migration), spec 024 (AI-agent devtools).

Test plan

  • Review problem statement + grading rubric align with team's definition of "A"
  • Review tier 1/3/4 palette model — confirm Tier 2 (brand-hint auto-extender) exclusion is intended
  • Review non-negotiables (forced-colors always wins, double-encoding always on, background contrast enforced)
  • Confirm app-level .AlternateView() contract vs. framework-owned data-table
  • Open questions (§Open Questions) — ForceGraph keyboard model, .ColorOnly() warning vs error, small-multiples rollup, sparkline size threshold, canonical ChartDataGrid sample
  • Phasing is realistic against current team capacity

🤖 Generated with Claude Code

Design spec targeting an "A" grade on charting accessibility: WCAG 2.2 AA
conformance out of the box, keyboard / screen-reader / forced-colors /
reduced-motion support on par with Highcharts and Power BI.

Eight layers — UIA ChartAutomationPeer with IGridProvider mapping, accessor-
driven labels and auto-summary, app-supplied .AlternateView() toggle,
ChartKeyboardNavigator with Highcharts/Power-BI-compatible bindings,
viewport and overlay focus context, debounced polite live region, forced-
colors plus reduced-motion plus palette customization (Tier 1 curated /
Tier 3 validated / Tier 4 escape hatch plus ChartPalette.Harden utility),
and scanner rules A11Y_CHART_001–012.

Sonification and framework-owned data-table fallback explicitly out of
scope — app-level responsibility.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new design spec (spec 026) that defines an end-to-end architecture and rollout plan for bringing Reactor charting up to an “A” accessibility grade (WCAG 2.2 AA), including UIA exposure, keyboard navigation, live-region announcements, forced-colors/reduced-motion behavior, palette hardening, and scanner rules.

Changes:

  • Introduces docs/specs/026-charting-accessibility-design.md describing an 8-layer chart accessibility architecture (UIA peer → summaries/labels → alternate view → keyboard nav → focus context → live region → forced-colors/reduced-motion/palettes → scanner rules).
  • Defines a phased delivery plan and an “A-grade” rubric for chart accessibility acceptance.
  • Specifies proposed APIs/modifiers and new AccessibilityScanner rule IDs for chart-specific diagnostics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- UseReducedMotion correctly marked as planned (not shipped)
- Normalize to AccessibilitySettings.HighContrast (matches repo usage)
- Architecture diagram rule range reconciled to 001-007, 009-012
- .AccessibilityHidden() instead of "UIA.Visibility = Collapsed"
- D3Dsl.IsForcedColors uses [ThreadStatic] to match IsDarkTheme pattern
- ChartPalette as sealed class with private ctor (static class could not
  hold instance-typed static members — would not compile)
- A11Y_CHART_005 reworded to reflect that hit-target expansion is
  automatic in §7.5; rule fires only when .TightHitTest() disables it

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@codemonkeychris
Chris Anderson (codemonkeychris) merged commit d01a3a2 into main Apr 20, 2026
3 checks passed
@codemonkeychris
Chris Anderson (codemonkeychris) deleted the docs/charting-a11y-spec branch May 28, 2026 19:11
Alexandre Zollinger Chohfi (azchohfi) added a commit that referenced this pull request Jun 26, 2026
Every component re-render re-runs every hook, so per-render hook
allocations multiply by cells x hooks on data-grid workloads
(StocksGrid). This eliminates the hot-path allocations in the hooks
bookkeeping layer while preserving the rules of hooks (same call
order/count/types every render) and observable semantics.

RenderContext.cs:
- #42 ValueHookState Lock is now lazy/nullable (allocated only when
  threadSafe:true); saves N rows x M hooks of unused Lock objects.
- #43 UseState setter cached on the hook slot (built once, not a new
  display-class + Action<T> every render).
- #44 UseReducer<T> updater and UseReducer<TState,TAction> dispatch
  delegates cached on the hook; dispatch reads the latest reducer from
  state (matches React semantics).
- #45/#46/#48 UseEffect/UseMemo/UseCallback gain arity 1-3 deps
  overloads that compare deps without boxing and allocate the deps
  array only when deps actually change; params overloads kept as
  fallback and now assign Dependencies directly (no extra ToArray).
  UseCallback no longer allocates a ()=>callback wrapper.
- #50 _hooks list pre-sized to new(8) to avoid mount realloc churn.
- #51 ContextHooks uses a struct enumerator (no heap enumerator per
  render); still implements IEnumerable for existing .ToList() callers.
- #52 UseCommand/UseCommand<T> use an inline memo slot instead of a
  per-render factory closure capturing 7 vars.
- #53 UsePersisted setter cached on the hook slot.
- #56 new internal UseDisposableEffect(IDisposable) mount-once helper
  with a stable teardown (no 2 lambdas per render).

Hooks/:
- #47 UseMemoCells/ByKey/ByIndex early full-reuse: return the prior
  children array and skip snapshot/dict allocation on a full cache hit.
- #59 UseMemoCellsByKey computes each key once per item into a buffer
  instead of invoking the key selector twice.
- #55 UseElementFocus caches the requestFocus closure and DispatcherQueue
  in refs instead of allocating + a COM call every render.
- #57 UseResource uses an Interlocked counter id (not Guid.NewGuid) and
  skips the deps-hash rebuild when deps are unchanged; #56 disposes via
  UseDisposableEffect.
- #56 UseMutation/UseInfiniteResource dispose via UseDisposableEffect.

PanelAttachedHooks.cs:
- #60 ApplyRelativePanelAttachedProps reuses a thread-static name-map
  dictionary (with a reentrancy guard for nested RelativePanels) instead
  of allocating one per reconcile.

Tests: tests/Reactor.Tests/HookAllocationPerfTests.cs (25 tests) cover
cached-delegate identity across renders, deps short-circuit (params +
arity), threadSafe Lock still allocated + correct under concurrent
writes (null when not requested), and UseMemoCells/ByKey/ByIndex
cache-hit returning the same prior children array.

The two committed skills/reactor.api.txt copies are regenerated to add
the new public arity overloads (UseDisposableEffect stays internal).

Closes #659

Co-authored-by: Copilot <[email protected]>
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.

2 participants