[Color Picker - Editor] Accessibility: Screen Reader announces 'Copied to Clipboard' (#12373)

This commit is contained in:
Andrey Nekrasov 2021-07-15 10:25:39 +03:00 committed by GitHub
parent d583b083d1
commit e965fcb690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -4,6 +4,7 @@
using System;
using System.Windows;
using System.Windows.Automation.Peers;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
@ -90,6 +91,20 @@ namespace ColorPicker.Controls
resize.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseInOut };
ColorCopiedNotificationBorder.BeginAnimation(Border.OpacityProperty, opacityAppear);
ColorCopiedNotificationBorder.BeginAnimation(Border.HeightProperty, resize);
var clipboardNotification = ((Decorator)ColorCopiedNotificationBorder).Child;
if (clipboardNotification == null)
{
return;
}
var peer = UIElementAutomationPeer.FromElement(clipboardNotification);
if (peer == null)
{
peer = UIElementAutomationPeer.CreatePeerForElement(clipboardNotification);
}
peer.RaiseAutomationEvent(AutomationEvents.MenuOpened);
}
private void HideCopiedIndicator()

View File

@ -173,7 +173,9 @@
<TextBlock FontSize="16"
Foreground="White"
HorizontalAlignment="Center"
VerticalAlignment="Center" >
VerticalAlignment="Center"
AutomationProperties.LiveSetting="Assertive"
AutomationProperties.Name="{x:Static p:Resources.Copied_to_clipboard}">
<Run Text="&#xE16F; " FontFamily="Segoe MDL2 Assets"/>
<Run Text="{x:Static p:Resources.Copied_to_clipboard}" FontWeight="SemiBold"/>
</TextBlock>