Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Engineering@Microsoft 4 min read How-to mediumAdept

Implementing an accessible, checkable WPF Tree View

Checkboxes nested inside WPF TreeViewItems don't report checked state to screen readers, because TreeViewItem doesn't support the UI Automation toggle control pattern. Stuffing "checked"/"unchecked" into the control name is a poor workaround: it bypasses screen reader customization and never announces state changes. The fix in Accessibility Insights for Windows uses a chain of custom subclasses: CheckableTreeView, CheckableTreeViewItem, and two custom automation peers. The final peer implements IToggleProvider by wiring the view model's existing IsChecked property to ToggleState and Toggle.

Assumes: WPF and XAMLUI Automation basics

Related posts

  • Accessibility Insights for Windows

    Engineering@Microsoft mediumAdept

    Accessibility Insights for Windows is an open-source .NET/WPF tool built on Microsoft's UI Automation framework for finding and fixing accessibility issues in Windows apps. Inspect mode exposes each element's position in the UI Automation tree plus its properties and patterns, which is the same data screen readers see. FastPass combines rule-based Automated Checks with a Tab Stops test driven by FocusChanged events, and Event mode records the UI Automation events assistive technologies observe. A Color Contrast Analyzer checks colors against WCAG ratios, and the rules engine, Axe.Windows, ships as a NuGet package with a CLI so the checks can run in tests and CI/CD pipelines.

  • Considerations for making a tree view component accessible

    GitHub Engineering mediumAdept

    GitHub's accessible file tree models Windows File Explorer's tree view behavior, since that is what many desktop screen reader users already know. It is built on nested ul/li semantics, which help with less common assistive tech and Forced Color Mode. ARIA tree, treeitem and group roles are layered on top, along with a roving tabindex inside a single-tab-stop composite widget wrapped in a nav landmark. Roving tabindex was chosen because aria-activedescendant failed with VoiceOver. Interoperability fixes include explicit aria-level on each node, aria-labelledby for accessible names that VoiceOver otherwise missed, live-region announcements and focus management for loading states, and JavaScript to replicate middle-click link behavior.

  • Accessibility considerations behind code search and code view

    GitHub Engineering mediumAdept

    GitHub rebuilt code search and code view to remove accessibility barriers that pushed screen reader users toward raw files. After a sort change triggers a full page navigation, focus is restored to the sort dropdown. After a search, focus moves to the results-count header instead of using aria-live announcements, which race with page-title announcements. The file tree became the open-source TreeView component, with typeahead and strict ARIA markup. Code reading uses a hidden <textarea> modeled on Monaco, layered under syntax-highlighted virtualized lines with a synced fake cursor. That design enables native screen reader navigation, find and select-all, but brings costs: scroll syncing, cross-browser quirks, and Firefox text-zoom mismatches.

  • An HTML Switch Control

    WebKit mediumAdept

    Safari 17.4 adds a native HTML switch control via `<input type=checkbox switch>`, which falls back to a plain checkbox in browsers without support. It mirrors the checkbox API (`:indeterminate` never matches), uses the ARIA switch role with On/Off announcements and OS accessibility indicators, and supports vertical writing modes. It also honors `accent-color` on the track, and `appearance: none` resets all properties to initial values for full custom styling. Use a switch for on/off settings and a checkbox for selection. Experimental `::thumb` and `::track` pseudo-elements sit behind a feature flag pending standardization.

  • Automated Accessibility Testing at Slack

    Slack Engineering mediumAdept

    Slack added automated accessibility checks to its desktop end-to-end tests by integrating Axe into Playwright via @axe-core/playwright, after embedding checks in Jest/React Testing Library proved impractical with its custom Jest setup. Hooking Axe into Playwright's interaction methods was also ruled out, because Locator auto-waiting only guarantees element readiness, not full-page render. The team instead exposed a `runAxeAndSaveViolations` helper on its custom `slack` fixture, scoped to WCAG 2.1 A/AA, excluding known-issue selectors, and reporting only deduplicated critical violations. Results feed a non-blocking 91-test suite gated by an A11Y_ENABLE flag, with screenshots in the Playwright HTML reporter, daily Buildkite runs alerting into Slack, and a Jira workflow for triage with the accessibility team.

The quest for software engineering knowledge.

Look:
Layout: