Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added basic date/time picker automation peers. #17426

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

grokys
Copy link
Member

@grokys grokys commented Nov 4, 2024

What does the pull request do?

Currently, DatePicker and TimePicker have no automation peer, meaning that they don't show up in the automation tree1.

This PR adds basic automation peers for these controls, causing them to show up as controls of type Custom in the automation tree. This matches how they show up in WPF (though in WinUI they show up as "Group" for some reason). UIA and NSAccessibility don't have a control type/role for date/time pickers.

The peers implement IValueProvider allowing the value to be set through automation. The parsing of the date/time is done using a simple DateTimeOffset.TryParse or TimeSpan.TryParse, so will use the OS/application culture.

Ideally, the automation peers should also implement IExpandCollapseProvider but this was not done here because:

  • There is no IsDropDownOpen or equivalent API for opening/closing the date/time picker
  • The date/time pickers in WinUI don't implement this provider either, so I doubt it's important

Footnotes

  1. More accurately, they will show up only in the Raw view in UIA and isAccessibilityElement will return false on macOS

@grokys grokys added customer-priority Issue reported by a customer with a support agreement. backport-candidate-11.2.x Consider this PR for backporting to 11.2 branch labels Nov 4, 2024
@grokys grokys marked this pull request as draft November 4, 2024 11:18
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0053038-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@11khugener
Copy link

I did a quick tests if our application and automation now works.
Meaning automation id is now respected and we were able to set the value through IValueProvider.

@grokys grokys marked this pull request as ready for review November 7, 2024 08:32
@maxkatz6 maxkatz6 merged commit 57b4be4 into master Nov 8, 2024
12 checks passed
@maxkatz6 maxkatz6 deleted the feature/date-time-picker-automation branch November 8, 2024 10:17
@maxkatz6 maxkatz6 added backported-11.2.x and removed backport-candidate-11.2.x Consider this PR for backporting to 11.2 branch labels Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported-11.2.x customer-priority Issue reported by a customer with a support agreement. enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants