Skip to content

Add opt-in accessibility features to TreeView component#323

Merged
csharpfritz merged 5 commits intodevfrom
copilot/improve-treeview-accessibility
Jan 31, 2026
Merged

Add opt-in accessibility features to TreeView component#323
csharpfritz merged 5 commits intodevfrom
copilot/improve-treeview-accessibility

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 31, 2026

TreeView controls present accessibility barriers for keyboard, screen reader, speech recognition, and touch device users. Small expand/collapse targets are difficult to activate, and lack of keyboard navigation forces mouse dependency.

Changes

  • New parameter: UseAccessibilityFeatures (default: false) enables ARIA markup and keyboard navigation
  • ARIA attributes: role="tree", role="treeitem", aria-expanded, aria-level, aria-label
  • Keyboard navigation:
    • Arrow Right/Left: expand/collapse nodes
    • Enter/Space: activate links or toggle expansion
    • Tab: focus management via tabindex="0"
  • Tests: 10 new tests covering ARIA attributes and keyboard interactions
  • Documentation: Updated TreeView.md with accessibility section and added sample page

Usage

<TreeView UseAccessibilityFeatures="true">
    <Nodes>
        <TreeNode Text="Home" Expanded="true">
            <TreeNode Text="Products" />
        </TreeNode>
    </Nodes>
</TreeView>

Screenshot

TreeView with accessibility features

Shows standard TreeView vs. accessible version with keyboard navigation documentation.

Backwards Compatibility

Feature is opt-in. Default behavior unchanged - maintains original Web Forms HTML output.

Original prompt

This section details on the original issue you should resolve

<issue_title>Accessibility concerns regarding Treeview and other controls</issue_title>
<issue_description>Using a Treeview can have some negative effects on accessibility users. From a personal point of view when using speech recognition.

It is very hard to move the mouse to a certain point to expand a node, especially when it is so small.

If a Treeview is used it would be helpful to have a search text box that will filter the nodes below. Also the arrow keys should work for moving around in the Treeview and expanding the nodes.

A Treeview is not very good for touch centric devices as generally the expand touch area is very small.

Also drop-down menus can have problems from a speech recognition point of view. At the very least they need to have something to indicate they drop-down.

When things only happen when a mouse hovers over something, it can be very difficult to discover this!</issue_description>

Comments on the Issue (you are @copilot in this section)

@csharpfritz I really like this suggestion, and for the TreeView I would like to introduce a boolean property "UseAccessibilityFeatures" that adds aria tags and helps improve keyboard navigation for the elements of the TreeView

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits January 31, 2026 14:37
…dex support

Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
@csharpfritz csharpfritz marked this pull request as ready for review January 31, 2026 14:42
Copilot AI changed the title [WIP] Address accessibility concerns for Treeview and controls Add opt-in accessibility features to TreeView component Jan 31, 2026
Copilot AI requested a review from csharpfritz January 31, 2026 14:45
@csharpfritz
Copy link
Copy Markdown
Collaborator

@copilot There are some integration tests with messages that look like a failure.

Server Output: fail: Style[0]

Are these test failures? Repair them if they are broken

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 31, 2026

@copilot There are some integration tests with messages that look like a failure.

Server Output: fail: Style[0]
...

These are not test failures - they are informational log messages from the server about BackColor values in UIStyle components. The integration tests are passing successfully.

The "Server Output: fail: Style[0]" messages appear in the console output because the PlaywrightFixture captures all server output for debugging purposes. These are standard ASP.NET Core log messages (likely at "fail" log level) about color parsing or styling operations.

Latest integration test run (21546075567): All 57 tests passed ✅

  • No actual test failures
  • All components load without errors
  • TreeView accessibility features working correctly

The messages are unrelated to the TreeView accessibility changes and represent existing logging behavior in the application.

@csharpfritz csharpfritz merged commit 172d3dd into dev Jan 31, 2026
3 checks passed
@csharpfritz csharpfritz deleted the copilot/improve-treeview-accessibility branch January 31, 2026 14:50
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.

Accessibility concerns regarding Treeview and other controls

2 participants