Polish AutomationProperties and UIA Tree Navigation (#4805)

AutomationProperties of interest in this PR include...
- Name: the name of a UI element (generally used as the main identifier
  for it)
- HelpText: an additional description for a more complex UI element
- AccessibilityView[1]
  - Raw: hide from the UIA tree. Only navigate to this if you know what
    you're doing
  - Control: a control without any content in it. Basically, a point at
    which the user can make a decision as to how to navigate the tree or
    invoke an action.
  - Content: a control that also has content to present to the user.

I set a few more AutomationProperties throughout Windows Terminal...
- MinMaxClose Control: hidden (we can/should rely on the true buttons
  that we are hiding)
- SplitButton: Name and Help text (currently ignored due to #4804, but
  having it in the resource file won't cause any problems)
- SearchBox: added a more specific name to the close button
- BackgroundImage: hide it

## References
A few additional work items have been created for tracking...
- SplitButton: https://github.com/microsoft/terminal/issues/4804

## PR Checklist
* [X] Closes #2099 
* [X] Closes #2102 

## Validation Steps Performed
Verified using Accessibility Insights and Inspect.exe

[1] https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-treeoverview
This commit is contained in:
msftbot[bot] 2020-03-05 22:32:46 +00:00 committed by GitHub
parent 3953b71d95
commit 27342db1aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 73 additions and 37 deletions

View file

@ -131,16 +131,24 @@ the MIT License. See LICENSE in the project root for license information. -->
</ResourceDictionary>
</StackPanel.Resources>
<Button Height="36.0" MinWidth="46.0" Width="46.0" x:Name="MinimizeButton" Style="{StaticResource CaptionButton}" Click="_MinimizeClick"
AutomationProperties.Name="Minimize">
<Button Height="36.0" MinWidth="46.0" Width="46.0"
x:Name="MinimizeButton"
x:Uid="WindowMinimizeButton"
Style="{StaticResource CaptionButton}"
Click="_MinimizeClick"
AutomationProperties.AccessibilityView="Raw">
<Button.Resources>
<ResourceDictionary>
<x:String x:Key="CaptionButtonPath">M 0 0 H 10</x:String>
</ResourceDictionary>
</Button.Resources>
</Button>
<Button Height="36.0" MinWidth="46.0" Width="46.0" x:Name="MaximizeButton" Style="{StaticResource CaptionButton}" Click="_MaximizeClick"
AutomationProperties.Name="Maximize">
<Button Height="36.0" MinWidth="46.0" Width="46.0"
x:Name="MaximizeButton"
x:Uid="WindowMaximizeButton"
Style="{StaticResource CaptionButton}"
Click="_MaximizeClick"
AutomationProperties.AccessibilityView="Raw">
<Button.Resources>
<ResourceDictionary>
<x:String x:Key="CaptionButtonPath">M 0 0 H 10 V 10 H 0 V 0</x:String>
@ -148,8 +156,12 @@ the MIT License. See LICENSE in the project root for license information. -->
</ResourceDictionary>
</Button.Resources>
</Button>
<Button Height="36.0" MinWidth="46.0" Width="46.0" x:Name="CloseButton" Style="{StaticResource CaptionButton}" Click="_CloseClick"
AutomationProperties.Name="Close">
<Button Height="36.0" MinWidth="46.0" Width="46.0"
x:Name="CloseButton"
x:Uid="WindowCloseButton"
Style="{StaticResource CaptionButton}"
Click="_CloseClick"
AutomationProperties.AccessibilityView="Raw">
<Button.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>

View file

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
@ -268,4 +268,19 @@ Temporarily using the Windows Terminal default settings.
<data name="CmdStartingDirArgDesc" xml:space="preserve">
<value>Open in the given directory instead of the profile's set startingDirectory</value>
</data>
</root>
<data name="NewTabSplitButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.HelpText" xml:space="preserve">
<value>Press the button to open a new terminal tab with your default profile. Open the flyout to select which profile you want to open.</value>
</data>
<data name="NewTabSplitButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>New Tab</value>
</data>
<data name="WindowCloseButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Close</value>
</data>
<data name="WindowMaximizeButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Maximize</value>
</data>
<data name="WindowMinimizeButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Minimize</value>
</data>
</root>

View file

@ -22,6 +22,7 @@ the MIT License. See LICENSE in the project root for license information. -->
<mux:TabView.TabStripFooter>
<mux:SplitButton
x:Name="NewTabButton"
x:Uid="NewTabSplitButton"
Click="OnNewTabButtonClick"
VerticalAlignment="Stretch"
HorizontalAlignment="Left"
@ -29,7 +30,8 @@ the MIT License. See LICENSE in the project root for license information. -->
UseLayoutRounding="true"
FontFamily="Segoe MDL2 Assets"
FontWeight="SemiLight"
FontSize="12">
FontSize="12"
AutomationProperties.AccessibilityView="Control">
<!-- U+E710 is the fancy plus icon. -->
<mux:SplitButton.Resources>
<!-- Override the SplitButton* resources to match the tab view's button's styles. -->

View file

@ -372,6 +372,7 @@ namespace winrt::TerminalApp::implementation
WUX::Controls::IconSourceElement iconElement;
iconElement.IconSource(iconSource);
profileMenuItem.Icon(iconElement);
Automation::AutomationProperties::SetAccessibilityView(iconElement, Automation::Peers::AccessibilityView::Raw);
}
if (profile.GetGuid() == defaultProfileGuid)

View file

@ -36,6 +36,7 @@
#include <winrt/Windows.UI.Xaml.Hosting.h>
#include "winrt/Windows.UI.Xaml.Markup.h"
#include "winrt/Windows.UI.Xaml.Documents.h"
#include "winrt/Windows.UI.Xaml.Automation.h"
#include <winrt/Windows.ApplicationModel.DataTransfer.h>
#include <winrt/Microsoft.Toolkit.Win32.UI.XamlHost.h>

View file

@ -161,4 +161,7 @@
<value>terminal</value>
<comment>The type of control that the terminal ahderes to. Used to identify how a user can interact with this kind of control.</comment>
</data>
<data name="SearchBox_Close.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Close Search Box</value>
</data>
</root>

View file

@ -8,7 +8,8 @@
d:DesignHeight="768"
d:DesignWidth="1024">
<Canvas x:Name="Canvas" Visibility="Collapsed">
<Canvas x:Name="Canvas"
Visibility="Collapsed">
<TextBlock x:Name="TextBlock"
IsTextSelectionEnabled="false"
TextDecorations="Underline" />

View file

@ -29,7 +29,8 @@
-->
<Grid x:Name="RootGrid">
<Image x:Name="BackgroundImage" />
<Image x:Name="BackgroundImage"
AutomationProperties.AccessibilityView="Raw" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />