Skip to content

Unable to set AutomationProperties on DataGridCell #3400

Open
@mrlacey

Description

@mrlacey

Describe the bug

If using a DataGridTemplateColumn inside a DataGrid, it is not possible to set the appropriate automation properties on the DataCellTemplate. This leads to a UI Automation Tree that fails basic accessibility testing with Accessibility Insights for Windows. Specifically, it fails due to issues related to Section 508 502.3.1.

  • Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create a UWP app with Windows Template Studio
  2. Include a "DataGrid" page
  3. Test the app with 'Accessibility Insights for Windows'
  4. See failing tests

Expected behavior

It should be possible to set automation properties of all controls and controls provided by the toolkit should not prevent a developer from creating a fully accessible application.

Specifically, it should be possible to change the default automation properties provided by the DataGridCell. Preferably by exposed propertied, or by subclassing.

Screenshots

If applicable, add screenshots to help explain your problem.

This XAML:

image

Produces a UI Automation Tree like this:

image

Note the custom element with no name. This is what can't be changed.

Environment

NuGet Package(s): Microsoft.Toolkit.Uwp.UI.Controls.DataGrid

Package Version(s): 6.1.0

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [x] May 2020 Update (19041)
- [ ] Insider Build (build number: )

App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [x] May 2019 Update (18362)
- [x] May 2020 Update (19041)
- [ ] Insider Build (xxxxx)

Device form factor:
- [x] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio 
- [ ] 2017 (version: )
- [x] 2019 (version: 16.6.4) 
- [ ] 2019 Preview (version: )

Additional context

This was discovered while investigating the accessibility of apps generated by Windows Template Studio microsoft/TemplateStudio#3723

Originally raised as a question at https://stackoverflow.com/questions/63106165/how-to-set-the-automation-properties-of-a-datagridtemplatecolumn but now raising as an issue because it appears to be a limitation of the current implementation.

I recognize this is a potentially non-trivial fix and may not be addressed in the Toolkit but will have to wait until moved to be part of WinUI before it's addressed. If that's the case, it would be good to have this confirmed so expectations can be managed appropriately.

Also, connected with #3079 as this must be addressed to fully make an accessible content row.

Metadata

Metadata

Assignees

Labels

DataGrid 🔠Issues on DataGrid controlaccessibility ♿bug 🐛An unexpected issue that highlights incorrect behavior

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions