Skip to content

Fixed AutomationProperties.Name for DatePicker Button #10949

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dipeshmsft
Copy link
Member

@dipeshmsft dipeshmsft commented Jun 24, 2025

Description

The "Show Calendar" button for DatePicker control did not have any name set to it, which causes issues for users using Accessibility Features in Windows.

Customer Impact

Customers using Accessibility Features in Windows, like Narrator, etc. will be able to use the control with ease.

Regression

No

Testing

Local app + Narrator testing

Risk

Minimal

Microsoft Reviewers: Open in CodeFlow

@Copilot Copilot AI review requested due to automatic review settings June 24, 2025 06:27
@dipeshmsft dipeshmsft requested a review from a team as a code owner June 24, 2025 06:27
@dotnet-policy-service dotnet-policy-service bot added the PR metadata: Label to tag PRs, to facilitate with triage label Jun 24, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an accessibility issue by adding the missing AutomationProperties.Name attribute ("Show Calendar") to the DatePicker button.

  • Updates the DatePicker button in all relevant theme files (Fluent, Fluent.Light, Fluent.HC, Fluent.Dark)
  • Applies the same accessibility fix in the DatePicker.xaml style to improve compatibility with accessibility tools

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Fluent.xaml Added AutomationProperties.Name attribute to the DatePicker button
Fluent.Light.xaml Updated DatePicker button for consistent accessibility naming
Fluent.HC.xaml Fixed missing AutomationProperties.Name for accessibility compliance
Fluent.Dark.xaml Unified accessibility property update for DatePicker button
DatePicker.xaml Applied AutomationProperties.Name update in button style

@@ -1803,7 +1803,7 @@
<Border x:Name="BorderElement" Grid.ColumnSpan="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding Border.CornerRadius}" MinHeight="32">
</Border>
<DatePickerTextBox x:Name="PART_TextBox" Padding="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Button x:Name="PART_Button" Grid.Column="1" VerticalAlignment="Stretch" Style="{StaticResource CalendarButtonStyle}" Focusable="False" MinWidth="30">
<Button x:Name="PART_Button" Grid.Column="1" VerticalAlignment="Stretch" Style="{StaticResource CalendarButtonStyle}" AutomationProperties.Name="Show Calendar" Focusable="False" MinWidth="30">
Copy link
Preview

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using a resource binding for the AutomationProperties.Name attribute to support localization, ensuring that accessibility text can be translated as needed.

Copilot uses AI. Check for mistakes.

@@ -2620,7 +2620,7 @@
<Border x:Name="BorderElement" Grid.ColumnSpan="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding Border.CornerRadius}" MinHeight="32">
</Border>
<DatePickerTextBox x:Name="PART_TextBox" Padding="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Button x:Name="PART_Button" Grid.Column="1" VerticalAlignment="Stretch" Style="{StaticResource CalendarButtonStyle}" Focusable="False" MinWidth="30">
<Button x:Name="PART_Button" Grid.Column="1" VerticalAlignment="Stretch" Style="{StaticResource CalendarButtonStyle}" AutomationProperties.Name="Show Calendar" Focusable="False" MinWidth="30">
Copy link
Preview

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using a resource binding for the AutomationProperties.Name attribute to support localization, ensuring that accessibility text can be translated as needed.

Suggested change
<Button x:Name="PART_Button" Grid.Column="1" VerticalAlignment="Stretch" Style="{StaticResource CalendarButtonStyle}" AutomationProperties.Name="Show Calendar" Focusable="False" MinWidth="30">
<Button x:Name="PART_Button" Grid.Column="1" VerticalAlignment="Stretch" Style="{StaticResource CalendarButtonStyle}" AutomationProperties.Name="{DynamicResource DatePicker_ShowCalendar}" Focusable="False" MinWidth="30">

Copilot uses AI. Check for mistakes.

@@ -2505,7 +2505,7 @@
<Border x:Name="BorderElement" Grid.ColumnSpan="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding Border.CornerRadius}" MinHeight="32">
</Border>
<DatePickerTextBox x:Name="PART_TextBox" Padding="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Button x:Name="PART_Button" Grid.Column="1" VerticalAlignment="Stretch" Style="{StaticResource CalendarButtonStyle}" Focusable="False" MinWidth="30">
<Button x:Name="PART_Button" Grid.Column="1" VerticalAlignment="Stretch" Style="{StaticResource CalendarButtonStyle}" AutomationProperties.Name="Show Calendar" Focusable="False" MinWidth="30">
Copy link
Preview

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using a resource binding for the AutomationProperties.Name attribute to support localization, ensuring that accessibility text can be translated as needed.

Suggested change
<Button x:Name="PART_Button" Grid.Column="1" VerticalAlignment="Stretch" Style="{StaticResource CalendarButtonStyle}" AutomationProperties.Name="Show Calendar" Focusable="False" MinWidth="30">
<Button x:Name="PART_Button" Grid.Column="1" VerticalAlignment="Stretch" Style="{StaticResource CalendarButtonStyle}" AutomationProperties.Name="{DynamicResource DatePicker_ShowCalendar}" Focusable="False" MinWidth="30">

Copilot uses AI. Check for mistakes.

@@ -2605,7 +2605,7 @@
<Border x:Name="BorderElement" Grid.ColumnSpan="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding Border.CornerRadius}" MinHeight="32">
</Border>
<DatePickerTextBox x:Name="PART_TextBox" Padding="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Button x:Name="PART_Button" Grid.Column="1" VerticalAlignment="Stretch" Style="{StaticResource CalendarButtonStyle}" Focusable="False" MinWidth="30">
<Button x:Name="PART_Button" Grid.Column="1" VerticalAlignment="Stretch" Style="{StaticResource CalendarButtonStyle}" AutomationProperties.Name="Show Calendar" Focusable="False" MinWidth="30">
Copy link
Preview

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using a resource binding for the AutomationProperties.Name attribute to support localization, ensuring that accessibility text can be translated as needed.

Suggested change
<Button x:Name="PART_Button" Grid.Column="1" VerticalAlignment="Stretch" Style="{StaticResource CalendarButtonStyle}" AutomationProperties.Name="Show Calendar" Focusable="False" MinWidth="30">
<Button x:Name="PART_Button" Grid.Column="1" VerticalAlignment="Stretch" Style="{StaticResource CalendarButtonStyle}" AutomationProperties.Name="{DynamicResource DatePickerShowCalendarText}" Focusable="False" MinWidth="30">

Copilot uses AI. Check for mistakes.

@@ -196,6 +196,7 @@
Grid.Column="1"
VerticalAlignment="Stretch"
Style="{StaticResource CalendarButtonStyle}"
AutomationProperties.Name="Show Calendar"
Copy link
Preview

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using a resource binding for the AutomationProperties.Name attribute here as well to support localization, ensuring accessibility text is maintained across cultures.

Copilot uses AI. Check for mistakes.

Copy link

codecov bot commented Jun 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 13.36679%. Comparing base (7f34908) to head (5f2af96).
Report is 2 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##               main      #10949          +/-   ##
===================================================
+ Coverage   2.98754%   13.36679%   +10.37924%     
===================================================
  Files          3319        3319                  
  Lines        664894      664894                  
  Branches      74674       74674                  
===================================================
+ Hits          19864       88875       +69011     
+ Misses       644849      573479       -71370     
- Partials        181        2540        +2359     
Flag Coverage Δ
Debug 13.36679% <ø> (+10.37924%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant