From 7e5d97686441a78c29fa0d77e609b6d98f6ddbcf Mon Sep 17 00:00:00 2001 From: Marcel Wagner Date: Thu, 18 Mar 2021 20:49:49 +0100 Subject: [PATCH 1/7] Update infobar strings to be more descriptive and dependent on severity level --- dev/InfoBar/InfoBar.cpp | 37 ++++++++++++++++++++---- dev/InfoBar/InfoBar.h | 3 ++ dev/InfoBar/Strings/en-us/Resources.resw | 18 ++++++++++-- dev/ResourceHelper/ResourceAccessor.h | 5 +++- 4 files changed, 54 insertions(+), 9 deletions(-) diff --git a/dev/InfoBar/InfoBar.cpp b/dev/InfoBar/InfoBar.cpp index 7c365199d5..c150a44236 100644 --- a/dev/InfoBar/InfoBar.cpp +++ b/dev/InfoBar/InfoBar.cpp @@ -44,10 +44,10 @@ void InfoBar::OnApplyTemplate() // Do localization for the close button if (winrt::AutomationProperties::GetName(closeButton).empty()) { - const auto closeButtonName = ResourceAccessor::GetLocalizedStringResource(SR_InfoBarCloseButtonName); + const auto closeButtonName = ResourceAccessor::GetLocalizedStringResource(GetCloseButtonResourceName(Severity())); winrt::AutomationProperties::SetName(closeButton, closeButtonName); } - + m_closeButton.set(closeButton); // Setup the tooltip for the close button auto tooltip = winrt::ToolTip(); const auto closeButtonTooltipText = ResourceAccessor::GetLocalizedStringResource(SR_InfoBarCloseButtonTooltip); @@ -193,11 +193,27 @@ void InfoBar::UpdateSeverity() switch (Severity()) { - case winrt::InfoBarSeverity::Success: severityState = L"Success"; break; - case winrt::InfoBarSeverity::Warning: severityState = L"Warning"; break; - case winrt::InfoBarSeverity::Error: severityState = L"Error"; break; + case winrt::InfoBarSeverity::Success: + severityState = L"Success"; + break; + case winrt::InfoBarSeverity::Warning: + severityState = L"Warning"; + break; + case winrt::InfoBarSeverity::Error: + severityState = L"Error"; + break; }; + // Do localization for the close button + if (const auto closeButton = m_closeButton.get()) + { + if (winrt::AutomationProperties::GetName(closeButton).empty()) + { + const auto closeButtonName = ResourceAccessor::GetLocalizedStringResource(GetCloseButtonResourceName(Severity())); + winrt::AutomationProperties::SetName(closeButton, closeButtonName); + } + } + winrt::VisualStateManager::GoToState(*this, severityState, false); } @@ -234,3 +250,14 @@ void InfoBar::UpdateForeground() // If Foreground is set, then change Title and Message Foreground to match. winrt::VisualStateManager::GoToState(*this, ReadLocalValue(winrt::Control::ForegroundProperty()) == winrt::DependencyProperty::UnsetValue() ? L"ForegroundNotSet" : L"ForegroundSet", false); } + +const winrt::hstring InfoBar::GetCloseButtonResourceName(winrt::InfoBarSeverity severity) +{ + switch (severity) + { + case winrt::InfoBarSeverity::Success: return SR_InfoBarCloseButtonNameSeveritySuccess; + case winrt::InfoBarSeverity::Warning: return SR_InfoBarCloseButtonNameSeverityWarning; + case winrt::InfoBarSeverity::Error: return SR_InfoBarCloseButtonNameSeverityError; + }; + return SR_InfoBarCloseButtonNameSeverityInformational; +} diff --git a/dev/InfoBar/InfoBar.h b/dev/InfoBar/InfoBar.h index 1581c34983..3e90a31708 100644 --- a/dev/InfoBar/InfoBar.h +++ b/dev/InfoBar/InfoBar.h @@ -44,11 +44,14 @@ class InfoBar : void UpdateCloseButton(); void UpdateForeground(); + const winrt::hstring GetCloseButtonResourceName(winrt::InfoBarSeverity severity); + void OnForegroundChanged(const winrt::DependencyObject& sender, const winrt::DependencyProperty& args); winrt::InfoBarCloseReason m_lastCloseReason{ winrt::InfoBarCloseReason::Programmatic }; winrt::Button::Click_revoker m_closeButtonClickRevoker{}; + tracker_ref m_closeButton{ this }; bool m_applyTemplateCalled{ false }; bool m_notifyOpen{ false }; diff --git a/dev/InfoBar/Strings/en-us/Resources.resw b/dev/InfoBar/Strings/en-us/Resources.resw index b869a68c43..7f6f206ca2 100644 --- a/dev/InfoBar/Strings/en-us/Resources.resw +++ b/dev/InfoBar/Strings/en-us/Resources.resw @@ -117,9 +117,21 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Close - Automation name of the close button. + + Close error infobar + Automation name of the close button of an InfoBar with severity error. + + + Close informational infobar + Automation name of the close button of an InfoBar with severity informational. + + + Close success infobar + Automation name of the close button of an InfoBar with severity success. + + + Close warning infobar + Automation name of the close button of an InfoBar with severity warning. Close diff --git a/dev/ResourceHelper/ResourceAccessor.h b/dev/ResourceHelper/ResourceAccessor.h index edd251cd43..e2be293fe6 100755 --- a/dev/ResourceHelper/ResourceAccessor.h +++ b/dev/ResourceHelper/ResourceAccessor.h @@ -176,11 +176,14 @@ class ResourceAccessor sealed #define SR_NumberBoxDownSpinButtonName L"NumberBoxDownSpinButtonName" #define SR_ExpanderDefaultControlName L"ExpanderDefaultControlName" -#define SR_InfoBarCloseButtonName L"InfoBarCloseButtonName" #define SR_InfoBarOpenedNotification L"InfoBarOpenedNotification" #define SR_InfoBarClosedNotification L"InfoBarClosedNotification" #define SR_InfoBarCustomLandmarkName L"InfoBarCustomLandmarkName" #define SR_InfoBarCloseButtonTooltip L"InfoBarCloseButtonTooltip" +#define SR_InfoBarCloseButtonNameSeverityInformational L"InfoBarCloseButtonNameSeverityInformational" +#define SR_InfoBarCloseButtonNameSeveritySuccess L"InfoBarCloseButtonNameSeveritySuccess" +#define SR_InfoBarCloseButtonNameSeverityWarning L"InfoBarCloseButtonNameSeverityWarning" +#define SR_InfoBarCloseButtonNameSeverityError L"InfoBarCloseButtonNameSeverityError" #define SR_AutomationNameEllipsisBreadcrumbBarItem L"AutomationNameEllipsisBreadcrumbBarItem" From 6458c6efbf702581169a017ab3ff26f02eff7cc6 Mon Sep 17 00:00:00 2001 From: Marcel Wagner Date: Fri, 19 Mar 2021 00:41:43 +0100 Subject: [PATCH 2/7] Add icon and announcer severity information --- dev/InfoBar/InfoBar.cpp | 50 +++++++++++++++++++----- dev/InfoBar/InfoBar.h | 3 ++ dev/InfoBar/InfoBar.xaml | 3 +- dev/InfoBar/InfoBar_v1.xaml | 2 +- dev/InfoBar/Strings/en-us/Resources.resw | 36 ++++++++++++++++- dev/ResourceHelper/ResourceAccessor.h | 8 ++++ 6 files changed, 88 insertions(+), 14 deletions(-) diff --git a/dev/InfoBar/InfoBar.cpp b/dev/InfoBar/InfoBar.cpp index c150a44236..45dce0016e 100644 --- a/dev/InfoBar/InfoBar.cpp +++ b/dev/InfoBar/InfoBar.cpp @@ -13,6 +13,7 @@ #include "../ResourceHelper/Utils.h" static constexpr wstring_view c_closeButtonName{ L"CloseButton"sv }; +static constexpr wstring_view c_iconTextBlockName{ L"StandardIcon"sv }; static constexpr wstring_view c_contentRootName{ L"ContentRoot"sv }; InfoBar::InfoBar() @@ -55,6 +56,12 @@ void InfoBar::OnApplyTemplate() winrt::ToolTipService::SetToolTip(closeButton, tooltip); } + if (const auto iconTextblock = GetTemplateChildT(c_iconTextBlockName, controlProtected)) + { + m_standardIconTextBlock.set(iconTextblock); + winrt::AutomationProperties::SetName(iconTextblock, ResourceAccessor::GetLocalizedStringResource(GetIconSeverityLevelResourceName(Severity()))); + } + if (auto&& contentRootGrid = GetTemplateChildT(c_contentRootName, controlProtected)) { winrt::AutomationProperties::SetLocalizedLandmarkType(contentRootGrid, ResourceAccessor::GetLocalizedStringResource(SR_InfoBarCustomLandmarkName)); @@ -161,7 +168,8 @@ void InfoBar::UpdateVisibility(bool notify, bool force) auto const notificationString = StringUtil::FormatString( ResourceAccessor::GetLocalizedStringResource(SR_InfoBarOpenedNotification), Title().data(), - Message().data()); + Message().data(), + ResourceAccessor::GetLocalizedStringResource(GetSeverityLevelResourceName(Severity()))); winrt::get_self(peer)->RaiseOpenedEvent(Severity(), notificationString); } @@ -207,11 +215,13 @@ void InfoBar::UpdateSeverity() // Do localization for the close button if (const auto closeButton = m_closeButton.get()) { - if (winrt::AutomationProperties::GetName(closeButton).empty()) - { - const auto closeButtonName = ResourceAccessor::GetLocalizedStringResource(GetCloseButtonResourceName(Severity())); - winrt::AutomationProperties::SetName(closeButton, closeButtonName); - } + const auto closeButtonName = ResourceAccessor::GetLocalizedStringResource(GetCloseButtonResourceName(Severity())); + winrt::AutomationProperties::SetName(closeButton, closeButtonName); + } + + if (const auto iconTextblock = m_standardIconTextBlock.get()) + { + winrt::AutomationProperties::SetName(iconTextblock, ResourceAccessor::GetLocalizedStringResource(GetIconSeverityLevelResourceName(Severity()))); } winrt::VisualStateManager::GoToState(*this, severityState, false); @@ -255,9 +265,31 @@ const winrt::hstring InfoBar::GetCloseButtonResourceName(winrt::InfoBarSeverity { switch (severity) { - case winrt::InfoBarSeverity::Success: return SR_InfoBarCloseButtonNameSeveritySuccess; - case winrt::InfoBarSeverity::Warning: return SR_InfoBarCloseButtonNameSeverityWarning; - case winrt::InfoBarSeverity::Error: return SR_InfoBarCloseButtonNameSeverityError; + case winrt::InfoBarSeverity::Success: return SR_InfoBarCloseButtonNameSeveritySuccess; + case winrt::InfoBarSeverity::Warning: return SR_InfoBarCloseButtonNameSeverityWarning; + case winrt::InfoBarSeverity::Error: return SR_InfoBarCloseButtonNameSeverityError; }; return SR_InfoBarCloseButtonNameSeverityInformational; } + +const winrt::hstring InfoBar::GetSeverityLevelResourceName(winrt::InfoBarSeverity severity) +{ + switch (severity) + { + case winrt::InfoBarSeverity::Success: return SR_InfoBarSeveritySuccessName; + case winrt::InfoBarSeverity::Warning: return SR_InfoBarSeverityWarningName; + case winrt::InfoBarSeverity::Error: return SR_InfoBarSeverityErrorName; + }; + return SR_InfoBarSeverityInformationalName; +} + +const winrt::hstring InfoBar::GetIconSeverityLevelResourceName(winrt::InfoBarSeverity severity) +{ + switch (severity) + { + case winrt::InfoBarSeverity::Success: return SR_InfoBarIconSeveritySuccessName; + case winrt::InfoBarSeverity::Warning: return SR_InfoBarIconSeverityWarningName; + case winrt::InfoBarSeverity::Error: return SR_InfoBarIconSeverityErrorName; + }; + return SR_InfoBarIconSeverityInformationalName; +} diff --git a/dev/InfoBar/InfoBar.h b/dev/InfoBar/InfoBar.h index 3e90a31708..d33868e8f6 100644 --- a/dev/InfoBar/InfoBar.h +++ b/dev/InfoBar/InfoBar.h @@ -45,6 +45,8 @@ class InfoBar : void UpdateForeground(); const winrt::hstring GetCloseButtonResourceName(winrt::InfoBarSeverity severity); + const winrt::hstring GetSeverityLevelResourceName(winrt::InfoBarSeverity severity); + const winrt::hstring GetIconSeverityLevelResourceName(winrt::InfoBarSeverity severity); void OnForegroundChanged(const winrt::DependencyObject& sender, const winrt::DependencyProperty& args); @@ -52,6 +54,7 @@ class InfoBar : winrt::Button::Click_revoker m_closeButtonClickRevoker{}; tracker_ref m_closeButton{ this }; + tracker_ref m_standardIconTextBlock{ this }; bool m_applyTemplateCalled{ false }; bool m_notifyOpen{ false }; diff --git a/dev/InfoBar/InfoBar.xaml b/dev/InfoBar/InfoBar.xaml index c63cf18e81..bb42969ab9 100644 --- a/dev/InfoBar/InfoBar.xaml +++ b/dev/InfoBar/InfoBar.xaml @@ -141,8 +141,7 @@ FontSize="{StaticResource InfoBarIconFontSize}" Text="{StaticResource InfoBarInformationalIconGlyph}" Foreground="{ThemeResource InfoBarInformationalSeverityIconForeground}" - FontFamily="{ThemeResource SymbolThemeFontFamily}" - AutomationProperties.AccessibilityView="Raw" /> + FontFamily="{ThemeResource SymbolThemeFontFamily}"/> + AutomationProperties.AccessibilityView="Content" /> InfoBar This is the custom landmark used to denote an InfoBar to narrator. + + Icon severity error + Automation name used to announce the severity error icon. + + + Icon severity informational + Automation name used to announce the severity informational icon. + + + Icon severity success + Automation name used to announce the severity success icon. + + + Icon severity warning + Automation name used to announce the severity warning icon. + - %1!s! %2!s! - The formatted string read by narrator when the InfoBar opens: "{Title} {Message}" + %1!s! %2!s! %3!s! + The formatted string read by narrator when the InfoBar opens: "{Title} {Message}, {severity level}" + + + severity error + Name used to announce severity error to users. + + + severity informational + Name used to announce severity informational to users. + + + severity success + Name used to announce severity success to users. + + + severity warning + Name used to announce severity warning to users. \ No newline at end of file diff --git a/dev/ResourceHelper/ResourceAccessor.h b/dev/ResourceHelper/ResourceAccessor.h index e2be293fe6..b29ddc8f30 100755 --- a/dev/ResourceHelper/ResourceAccessor.h +++ b/dev/ResourceHelper/ResourceAccessor.h @@ -184,6 +184,14 @@ class ResourceAccessor sealed #define SR_InfoBarCloseButtonNameSeveritySuccess L"InfoBarCloseButtonNameSeveritySuccess" #define SR_InfoBarCloseButtonNameSeverityWarning L"InfoBarCloseButtonNameSeverityWarning" #define SR_InfoBarCloseButtonNameSeverityError L"InfoBarCloseButtonNameSeverityError" +#define SR_InfoBarSeverityInformationalName L"InfoBarSeverityInformationalName" +#define SR_InfoBarSeveritySuccessName L"InfoBarSeveritySuccessName" +#define SR_InfoBarSeverityWarningName L"InfoBarSeverityWarningName" +#define SR_InfoBarSeverityErrorName L"InfoBarSeverityErrorName" +#define SR_InfoBarIconSeverityInformationalName L"InfoBarIconSeverityInformationalName" +#define SR_InfoBarIconSeveritySuccessName L"InfoBarIconSeveritySuccessName" +#define SR_InfoBarIconSeverityWarningName L"InfoBarIconSeverityWarningName" +#define SR_InfoBarIconSeverityErrorName L"InfoBarIconSeverityErrorName" #define SR_AutomationNameEllipsisBreadcrumbBarItem L"AutomationNameEllipsisBreadcrumbBarItem" From 6c7054d467cf0105b09cd41ada5548118d38cc4c Mon Sep 17 00:00:00 2001 From: Marcel Wagner Date: Sat, 20 Mar 2021 21:38:37 +0100 Subject: [PATCH 3/7] Fix bug, update wording --- dev/InfoBar/InfoBar.cpp | 2 +- dev/InfoBar/Strings/en-us/Resources.resw | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/InfoBar/InfoBar.cpp b/dev/InfoBar/InfoBar.cpp index 45dce0016e..d1c5bd2b02 100644 --- a/dev/InfoBar/InfoBar.cpp +++ b/dev/InfoBar/InfoBar.cpp @@ -169,7 +169,7 @@ void InfoBar::UpdateVisibility(bool notify, bool force) ResourceAccessor::GetLocalizedStringResource(SR_InfoBarOpenedNotification), Title().data(), Message().data(), - ResourceAccessor::GetLocalizedStringResource(GetSeverityLevelResourceName(Severity()))); + ResourceAccessor::GetLocalizedStringResource(GetSeverityLevelResourceName(Severity())).data()); winrt::get_self(peer)->RaiseOpenedEvent(Severity(), notificationString); } diff --git a/dev/InfoBar/Strings/en-us/Resources.resw b/dev/InfoBar/Strings/en-us/Resources.resw index 53aec7cbed..f39be256c5 100644 --- a/dev/InfoBar/Strings/en-us/Resources.resw +++ b/dev/InfoBar/Strings/en-us/Resources.resw @@ -118,19 +118,19 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Close error infobar + Error infobar close button Automation name of the close button of an InfoBar with severity error. - Close informational infobar + Informational infobar close button Automation name of the close button of an InfoBar with severity informational. - Close success infobar + Success infobar close button Automation name of the close button of an InfoBar with severity success. - Close warning infobar + Warning infobar close button Automation name of the close button of an InfoBar with severity warning. From 3be610b01bcee81bb4d2149d0d050f65b675b57e Mon Sep 17 00:00:00 2001 From: Marcel Wagner Date: Mon, 22 Mar 2021 23:18:25 +0100 Subject: [PATCH 4/7] Update wording --- dev/InfoBar/InfoBar.cpp | 4 ++-- dev/InfoBar/Strings/en-us/Resources.resw | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dev/InfoBar/InfoBar.cpp b/dev/InfoBar/InfoBar.cpp index d1c5bd2b02..0495bb73e1 100644 --- a/dev/InfoBar/InfoBar.cpp +++ b/dev/InfoBar/InfoBar.cpp @@ -167,9 +167,9 @@ void InfoBar::UpdateVisibility(bool notify, bool force) { auto const notificationString = StringUtil::FormatString( ResourceAccessor::GetLocalizedStringResource(SR_InfoBarOpenedNotification), + ResourceAccessor::GetLocalizedStringResource(GetSeverityLevelResourceName(Severity())).data(), Title().data(), - Message().data(), - ResourceAccessor::GetLocalizedStringResource(GetSeverityLevelResourceName(Severity())).data()); + Message().data()); winrt::get_self(peer)->RaiseOpenedEvent(Severity(), notificationString); } diff --git a/dev/InfoBar/Strings/en-us/Resources.resw b/dev/InfoBar/Strings/en-us/Resources.resw index f39be256c5..a606bcde22 100644 --- a/dev/InfoBar/Strings/en-us/Resources.resw +++ b/dev/InfoBar/Strings/en-us/Resources.resw @@ -163,22 +163,22 @@ %1!s! %2!s! %3!s! - The formatted string read by narrator when the InfoBar opens: "{Title} {Message}, {severity level}" + The formatted string read by narrator when the InfoBar opens: "{Severity level}, {Title} {Message}" - severity error + Info message, severity error Name used to announce severity error to users. - severity informational + Info message, severity informational Name used to announce severity informational to users. - severity success + Info message, severity success Name used to announce severity success to users. - severity warning + Info message, severity warning Name used to announce severity warning to users. \ No newline at end of file From 1100c62229aca8330d5820f03db5f4aa0b429c8c Mon Sep 17 00:00:00 2001 From: Marcel Wagner Date: Wed, 7 Apr 2021 20:15:37 +0200 Subject: [PATCH 5/7] CR feedback --- dev/InfoBar/InfoBar.cpp | 23 ++--------------------- dev/InfoBar/InfoBar.h | 1 - dev/InfoBar/InfoBar.xaml | 1 + dev/InfoBar/Strings/en-us/Resources.resw | 18 +++--------------- dev/ResourceHelper/ResourceAccessor.h | 5 +---- 5 files changed, 7 insertions(+), 41 deletions(-) diff --git a/dev/InfoBar/InfoBar.cpp b/dev/InfoBar/InfoBar.cpp index 0495bb73e1..5caa8dca17 100644 --- a/dev/InfoBar/InfoBar.cpp +++ b/dev/InfoBar/InfoBar.cpp @@ -45,10 +45,9 @@ void InfoBar::OnApplyTemplate() // Do localization for the close button if (winrt::AutomationProperties::GetName(closeButton).empty()) { - const auto closeButtonName = ResourceAccessor::GetLocalizedStringResource(GetCloseButtonResourceName(Severity())); + const auto closeButtonName = ResourceAccessor::GetLocalizedStringResource(SR_InfoBarCloseButtonName); winrt::AutomationProperties::SetName(closeButton, closeButtonName); } - m_closeButton.set(closeButton); // Setup the tooltip for the close button auto tooltip = winrt::ToolTip(); const auto closeButtonTooltipText = ResourceAccessor::GetLocalizedStringResource(SR_InfoBarCloseButtonTooltip); @@ -167,7 +166,7 @@ void InfoBar::UpdateVisibility(bool notify, bool force) { auto const notificationString = StringUtil::FormatString( ResourceAccessor::GetLocalizedStringResource(SR_InfoBarOpenedNotification), - ResourceAccessor::GetLocalizedStringResource(GetSeverityLevelResourceName(Severity())).data(), + ResourceAccessor::GetLocalizedStringResource(GetIconSeverityLevelResourceName(Severity())).data(), Title().data(), Message().data()); @@ -212,13 +211,6 @@ void InfoBar::UpdateSeverity() break; }; - // Do localization for the close button - if (const auto closeButton = m_closeButton.get()) - { - const auto closeButtonName = ResourceAccessor::GetLocalizedStringResource(GetCloseButtonResourceName(Severity())); - winrt::AutomationProperties::SetName(closeButton, closeButtonName); - } - if (const auto iconTextblock = m_standardIconTextBlock.get()) { winrt::AutomationProperties::SetName(iconTextblock, ResourceAccessor::GetLocalizedStringResource(GetIconSeverityLevelResourceName(Severity()))); @@ -261,17 +253,6 @@ void InfoBar::UpdateForeground() winrt::VisualStateManager::GoToState(*this, ReadLocalValue(winrt::Control::ForegroundProperty()) == winrt::DependencyProperty::UnsetValue() ? L"ForegroundNotSet" : L"ForegroundSet", false); } -const winrt::hstring InfoBar::GetCloseButtonResourceName(winrt::InfoBarSeverity severity) -{ - switch (severity) - { - case winrt::InfoBarSeverity::Success: return SR_InfoBarCloseButtonNameSeveritySuccess; - case winrt::InfoBarSeverity::Warning: return SR_InfoBarCloseButtonNameSeverityWarning; - case winrt::InfoBarSeverity::Error: return SR_InfoBarCloseButtonNameSeverityError; - }; - return SR_InfoBarCloseButtonNameSeverityInformational; -} - const winrt::hstring InfoBar::GetSeverityLevelResourceName(winrt::InfoBarSeverity severity) { switch (severity) diff --git a/dev/InfoBar/InfoBar.h b/dev/InfoBar/InfoBar.h index d33868e8f6..6f37491d21 100644 --- a/dev/InfoBar/InfoBar.h +++ b/dev/InfoBar/InfoBar.h @@ -53,7 +53,6 @@ class InfoBar : winrt::InfoBarCloseReason m_lastCloseReason{ winrt::InfoBarCloseReason::Programmatic }; winrt::Button::Click_revoker m_closeButtonClickRevoker{}; - tracker_ref m_closeButton{ this }; tracker_ref m_standardIconTextBlock{ this }; bool m_applyTemplateCalled{ false }; diff --git a/dev/InfoBar/InfoBar.xaml b/dev/InfoBar/InfoBar.xaml index bb42969ab9..a172b21d86 100644 --- a/dev/InfoBar/InfoBar.xaml +++ b/dev/InfoBar/InfoBar.xaml @@ -10,6 +10,7 @@ + diff --git a/dev/InfoBar/Strings/en-us/Resources.resw b/dev/InfoBar/Strings/en-us/Resources.resw index a606bcde22..4bf80886d5 100644 --- a/dev/InfoBar/Strings/en-us/Resources.resw +++ b/dev/InfoBar/Strings/en-us/Resources.resw @@ -117,21 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Error infobar close button - Automation name of the close button of an InfoBar with severity error. - - - Informational infobar close button - Automation name of the close button of an InfoBar with severity informational. - - - Success infobar close button - Automation name of the close button of an InfoBar with severity success. - - - Warning infobar close button - Automation name of the close button of an InfoBar with severity warning. + + Close + Automation name of the close button. Close diff --git a/dev/ResourceHelper/ResourceAccessor.h b/dev/ResourceHelper/ResourceAccessor.h index b29ddc8f30..89c3e1b690 100755 --- a/dev/ResourceHelper/ResourceAccessor.h +++ b/dev/ResourceHelper/ResourceAccessor.h @@ -176,14 +176,11 @@ class ResourceAccessor sealed #define SR_NumberBoxDownSpinButtonName L"NumberBoxDownSpinButtonName" #define SR_ExpanderDefaultControlName L"ExpanderDefaultControlName" +#define SR_InfoBarCloseButtonName L"InfoBarCloseButtonName" #define SR_InfoBarOpenedNotification L"InfoBarOpenedNotification" #define SR_InfoBarClosedNotification L"InfoBarClosedNotification" #define SR_InfoBarCustomLandmarkName L"InfoBarCustomLandmarkName" #define SR_InfoBarCloseButtonTooltip L"InfoBarCloseButtonTooltip" -#define SR_InfoBarCloseButtonNameSeverityInformational L"InfoBarCloseButtonNameSeverityInformational" -#define SR_InfoBarCloseButtonNameSeveritySuccess L"InfoBarCloseButtonNameSeveritySuccess" -#define SR_InfoBarCloseButtonNameSeverityWarning L"InfoBarCloseButtonNameSeverityWarning" -#define SR_InfoBarCloseButtonNameSeverityError L"InfoBarCloseButtonNameSeverityError" #define SR_InfoBarSeverityInformationalName L"InfoBarSeverityInformationalName" #define SR_InfoBarSeveritySuccessName L"InfoBarSeveritySuccessName" #define SR_InfoBarSeverityWarningName L"InfoBarSeverityWarningName" From cb0089450d92974887e03ce0bb4b49cc6f1d6e19 Mon Sep 17 00:00:00 2001 From: Marcel Wagner Date: Mon, 19 Apr 2021 22:08:40 +0200 Subject: [PATCH 6/7] Update UIA name for icon --- dev/InfoBar/Strings/en-us/Resources.resw | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dev/InfoBar/Strings/en-us/Resources.resw b/dev/InfoBar/Strings/en-us/Resources.resw index 4bf80886d5..e8b55610db 100644 --- a/dev/InfoBar/Strings/en-us/Resources.resw +++ b/dev/InfoBar/Strings/en-us/Resources.resw @@ -134,19 +134,19 @@ This is the custom landmark used to denote an InfoBar to narrator. - Icon severity error + Error icon Automation name used to announce the severity error icon. - Icon severity informational + Informational icon Automation name used to announce the severity informational icon. - Icon severity success + Success icon Automation name used to announce the severity success icon. - Icon severity warning + Warning icon Automation name used to announce the severity warning icon. From ba81e158212bbbd23263cda88db4183df5729891 Mon Sep 17 00:00:00 2001 From: Tammy Paine <30241445+teaP@users.noreply.github.com> Date: Wed, 21 Apr 2021 13:37:01 -0700 Subject: [PATCH 7/7] Fix up indices --- dev/InfoBar/InteractionTests/InfoBarTests.cs | 23 ++++++++++---------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/dev/InfoBar/InteractionTests/InfoBarTests.cs b/dev/InfoBar/InteractionTests/InfoBarTests.cs index ea41eb8faa..8e42b431f9 100644 --- a/dev/InfoBar/InteractionTests/InfoBarTests.cs +++ b/dev/InfoBar/InteractionTests/InfoBarTests.cs @@ -145,13 +145,14 @@ public void LayoutTest() StatusBar infoBar = FindElement.ByName("TestInfoBar"); CheckBox customContent = FindElement.ByName("CustomContentCheckBox"); + // 0: icon; 1: title; 2: message; 3: action button Log.Comment("Verify that title, message, and action button layout is left-to-right"); - Verify.IsGreaterThan(infoBar.Children[1].BoundingRectangle.X, infoBar.Children[0].BoundingRectangle.X, "Expect Message to be on the right of Title"); - Verify.IsGreaterThan(infoBar.Children[2].BoundingRectangle.X, infoBar.Children[1].BoundingRectangle.X, "Expect action button to be on the right of Message"); - VerifyIsPrettyClose(infoBar.Children[1].BoundingRectangle.Y, infoBar.Children[0].BoundingRectangle.Y, "Expect Message to be top-aligned with Title"); + Verify.IsGreaterThan(infoBar.Children[2].BoundingRectangle.X, infoBar.Children[1].BoundingRectangle.X, "Expect Message to be on the right of Title"); + Verify.IsGreaterThan(infoBar.Children[3].BoundingRectangle.X, infoBar.Children[2].BoundingRectangle.X, "Expect action button to be on the right of Message"); + VerifyIsPrettyClose(infoBar.Children[2].BoundingRectangle.Y, infoBar.Children[1].BoundingRectangle.Y, "Expect Message to be top-aligned with Title"); - Verify.IsGreaterThan(customContent.BoundingRectangle.Y, infoBar.Children[0].BoundingRectangle.Y, "Expect custom content to be on under all other things"); - VerifyIsPrettyClose(customContent.BoundingRectangle.X, infoBar.Children[0].BoundingRectangle.X, "Expect custom content to be left-aligned with title"); + Verify.IsGreaterThan(customContent.BoundingRectangle.Y, infoBar.Children[1].BoundingRectangle.Y, "Expect custom content to be on under all other things"); + VerifyIsPrettyClose(customContent.BoundingRectangle.X, infoBar.Children[1].BoundingRectangle.X, "Expect custom content to be left-aligned with title"); Log.Comment("Change title and message to long strings"); Edit editTitle = FindElement.ByName("TitleTextBox"); @@ -160,13 +161,13 @@ public void LayoutTest() editMessage.SetValueAndWait("Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent vehicula mauris eu libero pretium ullamcorper."); Log.Comment("Verify that title, message, and action button layout is top-to-bottom"); - Verify.IsGreaterThan(infoBar.Children[1].BoundingRectangle.Y, infoBar.Children[0].BoundingRectangle.Y, "Expect Message to be below Title"); - Verify.IsGreaterThan(infoBar.Children[2].BoundingRectangle.Y, infoBar.Children[1].BoundingRectangle.Y, "Expect action button to be below Message"); - VerifyIsPrettyClose(infoBar.Children[1].BoundingRectangle.X, infoBar.Children[0].BoundingRectangle.X, "Expect Message to be left-aligned with Title"); - VerifyIsPrettyClose(infoBar.Children[2].BoundingRectangle.X, infoBar.Children[1].BoundingRectangle.X, "Expect action button to be left-aligned Message"); + Verify.IsGreaterThan(infoBar.Children[2].BoundingRectangle.Y, infoBar.Children[1].BoundingRectangle.Y, "Expect Message to be below Title"); + Verify.IsGreaterThan(infoBar.Children[3].BoundingRectangle.Y, infoBar.Children[2].BoundingRectangle.Y, "Expect action button to be below Message"); + VerifyIsPrettyClose(infoBar.Children[2].BoundingRectangle.X, infoBar.Children[1].BoundingRectangle.X, "Expect Message to be left-aligned with Title"); + VerifyIsPrettyClose(infoBar.Children[3].BoundingRectangle.X, infoBar.Children[2].BoundingRectangle.X, "Expect action button to be left-aligned Message"); - Verify.IsGreaterThan(customContent.BoundingRectangle.Y, infoBar.Children[2].BoundingRectangle.Y, "Expect custom content to be on under all other things"); - VerifyIsPrettyClose(customContent.BoundingRectangle.X, infoBar.Children[0].BoundingRectangle.X, "Expect custom content to be left-aligned with everyone else"); + Verify.IsGreaterThan(customContent.BoundingRectangle.Y, infoBar.Children[3].BoundingRectangle.Y, "Expect custom content to be on under all other things"); + VerifyIsPrettyClose(customContent.BoundingRectangle.X, infoBar.Children[1].BoundingRectangle.X, "Expect custom content to be left-aligned with everyone else"); } }