Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/xwt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBret Johnson <bret.johnson@microsoft.com>2018-07-18 10:47:07 +0300
committerBret Johnson <bret.johnson@microsoft.com>2018-07-18 10:48:19 +0300
commit1fb26f63768045d56ca3fe8667303643cddf845a (patch)
tree49baef18058bf2fde8fa961253925a3208cd2eac
parentaf283b37a4062d453f9987ae5772c2fd3b080147 (diff)
[a11y][WPF] Make Esc key close popovers
-rw-r--r--Xwt.WPF/Xwt.WPFBackend/ExTreeViewItem.cs2
-rw-r--r--Xwt.WPF/Xwt.WPFBackend/PopoverBackend.cs10
2 files changed, 11 insertions, 1 deletions
diff --git a/Xwt.WPF/Xwt.WPFBackend/ExTreeViewItem.cs b/Xwt.WPF/Xwt.WPFBackend/ExTreeViewItem.cs
index 2e010c4c..72a9d9d9 100644
--- a/Xwt.WPF/Xwt.WPFBackend/ExTreeViewItem.cs
+++ b/Xwt.WPF/Xwt.WPFBackend/ExTreeViewItem.cs
@@ -260,7 +260,7 @@ namespace Xwt.WPFBackend
// We only want to include TreeView items in the a11y tree, not their constituent image/text/etc controls -
// for one thing including all controls messes up the "item 3 of 5" style counts announced by the
- // narrator, as those controls would be included in the counts
+ // narrator, as those controls would be include
List<AutomationPeer> children = defaultChildren.Where (
child => child is TreeViewItemAutomationPeer || child is TreeViewDataItemAutomationPeer).ToList ();
return children;
diff --git a/Xwt.WPF/Xwt.WPFBackend/PopoverBackend.cs b/Xwt.WPF/Xwt.WPFBackend/PopoverBackend.cs
index a4a3c2a4..01d1ad01 100644
--- a/Xwt.WPF/Xwt.WPFBackend/PopoverBackend.cs
+++ b/Xwt.WPF/Xwt.WPFBackend/PopoverBackend.cs
@@ -114,6 +114,7 @@ namespace Xwt.WPFBackend
};
NativeWidget.Opened += NativeWidget_Opened;
NativeWidget.Closed += NativeWidget_Closed;
+ NativeWidget.PreviewKeyDown += NativeWidget_PreviewKeyDown;
}
public void Initialize (IPopoverEventSink sink)
@@ -163,6 +164,15 @@ namespace Xwt.WPFBackend
EventSink.OnClosed ();
}
+ void NativeWidget_PreviewKeyDown (object sender, System.Windows.Input.KeyEventArgs e)
+ {
+ // Close the popup when Escape is hit
+ if (e.Key == System.Windows.Input.Key.Escape) {
+ NativeWidget.IsOpen = false;
+ e.Handled = true;
+ }
+ }
+
public void Hide ()
{
NativeWidget.IsOpen = false;