From e1682f567b8eaa2d908738b56ad6197b6da799d2 Mon Sep 17 00:00:00 2001 From: Andrey Nekrasov Date: Thu, 15 Jul 2021 08:12:48 +0300 Subject: [PATCH] [Color Picker - Editor] Accessibility: Screen Reader announces 'Copied to Clipboard' --- .../Controls/ColorFormatControl.xaml.cs | 15 +++++++++++++++ .../ColorPickerUI/Views/ColorEditorView.xaml | 4 +++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/modules/colorPicker/ColorPickerUI/Controls/ColorFormatControl.xaml.cs b/src/modules/colorPicker/ColorPickerUI/Controls/ColorFormatControl.xaml.cs index 5a64b54c77fa..4da43589b231 100644 --- a/src/modules/colorPicker/ColorPickerUI/Controls/ColorFormatControl.xaml.cs +++ b/src/modules/colorPicker/ColorPickerUI/Controls/ColorFormatControl.xaml.cs @@ -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 @@ private void AppearCopiedIndicator() 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() diff --git a/src/modules/colorPicker/ColorPickerUI/Views/ColorEditorView.xaml b/src/modules/colorPicker/ColorPickerUI/Views/ColorEditorView.xaml index f269327d6bdc..ccb4e074985c 100644 --- a/src/modules/colorPicker/ColorPickerUI/Views/ColorEditorView.xaml +++ b/src/modules/colorPicker/ColorPickerUI/Views/ColorEditorView.xaml @@ -173,7 +173,9 @@ + VerticalAlignment="Center" + AutomationProperties.LiveSetting="Assertive" + AutomationProperties.Name="{x:Static p:Resources.Copied_to_clipboard}">