Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 18, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description

This PR enables keyboard navigation and screen reader support for Border controls on Windows by implementing a custom AutomationPeer, bringing Windows behavior in line with Mac Catalyst.

Currently, on Mac Catalyst, borders with SemanticProperties.Description can be navigated via keyboard and read by screen readers. On Windows, these borders are not recognized as focusable elements, preventing keyboard users from accessing them. This PR fixes that gap.

Changes

New file:

  • ContentPanelAutomationPeer.cs - Custom automation peer for ContentPanel (the platform view used by BorderHandler on Windows)

Modified files:

  • ContentPanel.cs - Added automation peer support and dynamic focusability based on semantic properties
  • ViewExtensions.cs - Extended UpdateSemantics() to update focusability for ContentPanel
  • BorderHandlerTests.Windows.cs - Added tests for automation peer and focusability behavior

Implementation Details

The implementation follows the same pattern as MauiButtonAutomationPeer:

  1. ContentPanelAutomationPeer identifies the control as a Group type for accessibility tools
  2. Dynamic Focusability: Borders become keyboard focusable (IsTabStop = true) only when SemanticProperties.Description is set
  3. Keyboard Support: Enter and Space key events are handled for potential future gesture integration
  4. Backwards Compatible: Borders without semantic properties remain non-focusable as before

Example Usage

<Border SemanticProperties.Description="Product item">
    <Label Text="Item 1" />
</Border>

With this PR, Windows users can now:

  • Navigate to the border using the Tab key
  • Have the semantic description read by screen readers
  • Interact with the border using keyboard (Enter/Space keys)

Testing

Added unit tests to verify:

  • ContentPanelAutomationPeer is correctly created
  • Focusability is enabled when semantic properties are set
  • Focusability is disabled when semantic properties are not set

Reference

Implementation approach was informed by PR #27713, but this implementation takes a more focused approach by:

  • Only making borders focusable when semantic properties are explicitly set
  • Following the established MauiButtonAutomationPeer pattern
  • Adding comprehensive tests for the behavior

Fixes #25712

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • scanning-api.github.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Adding AutomationPeers to Windows Borders</issue_title>
<issue_description>### Description

We should add an AutomationPeer to the Border control for Windows. On Mac Catalyst, if we have a bindable layout with the items being content inside of a border, we can add SemanticProperties.Descriptions to the borders and we can traverse the items with the keyboard arrows as well as have the items read by the screenreader. These elements are also selectable using the enter key. On Windows, the border items are not recognized as elements that can be focused with the keyboard.

We have an example of this AutomationPeer in our MauiButtonAutomationPeer class. We would need this BorderAutomationPeer to classify the metadata as something that is focusable.

We would also probably want a Keydown event on these borders so that the item is selectable with a hardware keyboard (maybe the enter and/or space key).

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

9.0.30 SR3

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

```</issue_description>

<agent_instructions>Use the following PR for reference https://github.com/dotnet/maui/pull/27713 but feel free to question the approach and come up with your own approach on how to fix this</agent_instructions>

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

<comments>
</comments>

Fixes #27627


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add AutomationPeer to Windows Border control Add AutomationPeer to Windows Borders for keyboard navigation and accessibility Oct 18, 2025
Copilot finished work on behalf of PureWeen October 18, 2025 20:36
Copilot AI requested a review from PureWeen October 18, 2025 20:36
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.

Adding AutomationPeers to Windows Borders wrong version in latest release

2 participants