Skip to content

Commit

Permalink
Update accessible names for 'add profile' page buttons (#12324)
Browse files Browse the repository at this point in the history
## Summary of the Pull Request
When using a screen reader, the buttons on the "add a new profile" page were being read weirdly:
- "New empty profile" button read as "create new button button"
- "duplicate" button read as "duplicate button button"

It's generally standard to read out the text inside the button, so I did just that by reusing the existing localized resources. This also removes the redundant "button" that is said by the screen reader.

I also removed the unused `AutomationId` and unnecessary `Button.Content` tags. 

#11156 can be closed upon validation by the accessibility team.

## Validation Steps Performed
✅ navigate to both buttons using Narrator; make sure it sounds right
  • Loading branch information
carlos-zamora authored Feb 2, 2022
1 parent 3e75f25 commit 24c5f7b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/cascadia/TerminalSettingsEditor/AddProfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
#include "AddProfilePageNavigationState.g.cpp"
#include "EnumEntry.h"

#include <LibraryResources.h>

using namespace winrt::Windows::Foundation;
using namespace winrt::Windows::System;
using namespace winrt::Windows::UI::Core;
using namespace winrt::Windows::UI::Xaml;
using namespace winrt::Windows::UI::Xaml::Navigation;
using namespace winrt::Microsoft::Terminal::Settings::Model;

Expand All @@ -18,6 +21,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
AddProfile::AddProfile()
{
InitializeComponent();

Automation::AutomationProperties::SetName(AddNewButton(), RS_(L"AddProfile_AddNewTextBlock/Text"));
Automation::AutomationProperties::SetName(DuplicateButton(), RS_(L"AddProfile_DuplicateTextBlock/Text"));
}

void AddProfile::OnNavigatedTo(const NavigationEventArgs& e)
Expand Down
8 changes: 2 additions & 6 deletions src/cascadia/TerminalSettingsEditor/AddProfile.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@

<ScrollViewer ViewChanging="ViewChanging">
<StackPanel Style="{StaticResource SettingsStackStyle}">
<Button x:Uid="AddProfile_AddNewButton"
AutomationProperties.AutomationId="AddProfile_AddNewButton"
AutomationProperties.Name="{Binding Tag, RelativeSource={RelativeSource Self}}"
<Button x:Name="AddNewButton"
Click="AddNewClick"
Style="{StaticResource AccentButtonStyle}">
<Button.Content>
Expand Down Expand Up @@ -68,10 +66,8 @@
</muxc:RadioButtons.ItemTemplate>
</muxc:RadioButtons>
</local:SettingContainer>
<Button x:Uid="AddProfile_DuplicateButton"
<Button x:Name="DuplicateButton"
Margin="{StaticResource StandardControlMargin}"
AutomationProperties.AutomationId="AddProfile_DuplicateButton"
AutomationProperties.Name="{Binding Tag, RelativeSource={RelativeSource Self}}"
Click="DuplicateClick"
IsEnabled="{x:Bind IsProfileSelected, Mode=OneWay}"
Style="{StaticResource AccentButtonStyle}">
Expand Down

0 comments on commit 24c5f7b

Please sign in to comment.