Repository: microsoft/terminal (language: cpp)

Issue:
[Window Terminal]: Keyboard only users are not able to access 'Don't show again', 'Open Settings' and 'X' controls which present inside information pop-up.
### Windows Terminal version

1.12.2931.0

### Windows build number

10.0.22504.1010

### Other Software

**Test Environment: **
OS: Windows 11 Version Dev (OS Build 22504.1010)
App: Windows Terminal Preview
Screen Reader: Narrator
Tool: Accessibility Insights for Windows Version 1.1.1741.1

### Steps to reproduce

**Repro Steps: **
1. Open Windows Terminal.
2. Open Settings page using 'Ctr+,'.
3. Inside Startup page, Set Default Terminal to 'Window Console Host'.
4. Save changes the open Terminal app gain.
5. Verify that Keyboard users can access 'Open Settings' and 'X' control.
6. Then open Command palette using 'Ctrl + Shift + p' and in command line mode Execute 'Dir'.
7. Verify that Keyboard users can access 'Don't Show again' and 'X' control.

**User Experience: **
Keyboard users like Keyboard only users, Screen Reader users will be impacted here as they are not able to access control which mouse users are able to access.

**Guideline Reference: **
https://www.w3.org/WAI/WCAG21/Understanding/keyboard

Attachments:
[Keyboard user is not able to access 'Don't Show again', 'Open Settings' and 'X' control.zip](https://github.com/microsoft/terminal/files/7701286/Keyboard.user.is.not.able.to.access.Don.t.Show.again.Open.Settings.and.X.control.zip)

### Expected Behavior

Keyboard only users should be able to access 'Don't show again', 'Open Settings' and 'X' controls which present inside information pop-up. Or A Shortcut should be given or announced to jump directly to Information pop-up.

### Actual Behavior

Keyboard only users are not able to access 'Don't show again', 'Open Settings' and 'X' controls which present inside information pop-up.

Observation: Screen Reader users are only able to access information pop-up in Scan mode.


Discussion / hints:
ideas: 
* How do you tab navigate to the infobar in VS?
* Same question, but with Word? 
* We should consult with the WinUI folks and see what the guidance is here. 
* Last resort, we add an "Alt wormhole" where pressing Alt without any other keys lets you press <kbd>tab</kbd> to get into the tab strip/infobar for tab navigation, and a setting to disable that wormhole as well. 

Fix patch:
diff --git a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw
index 3ad4bdb73b8..3f91408815f 100644
--- a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw
+++ b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw
@@ -771,19 +771,12 @@
   <data name="CloseOnExitInfoBar.Message" xml:space="preserve">
     <value>Termination behavior can be configured in advanced profile settings.</value>
   </data>
-  <data name="SetAsDefaultInfoBar.Message" xml:space="preserve">
-    <value>Windows Terminal can be set as the default terminal application in your settings.</value>
-  </data>
   <data name="InfoBarDismissButton.Content" xml:space="preserve">
     <value>Don't show again</value>
   </data>
   <data name="ElevationShield.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
     <value>This Terminal window is running as Admin</value>
   </data>
-  <data name="SetAsDefaultTip_OpenSettingsLink.Content" xml:space="preserve">
-    <value>Open Settings</value>
-    <comment>This is a call-to-action hyperlink; it will open the settings.</comment>
-  </data>
   <data name="CommandPalette_MatchesAvailable" xml:space="preserve">
     <value>Suggestions found: {0}</value>
     <comment>{0} will be replaced with a number.</comment>
diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp
index 608abe0c0db..a46544ce60c 100644
--- a/src/cascadia/TerminalApp/TerminalPage.cpp
+++ b/src/cascadia/TerminalApp/TerminalPage.cpp
@@ -283,8 +283,6 @@ namespace winrt::TerminalApp::implementation
             _defaultPointerCursor = CoreWindow::GetForCurrentThread().PointerCursor();
         }
         CATCH_LOG();
-
-        ShowSetAsDefaultInfoBar();
     }
 
     Windows::UI::Xaml::Automation::Peers::AutomationPeer TerminalPage::OnCreateAutomationPeer()
@@ -3862,9 +3860,6 @@ namespace winrt::TerminalApp::implementation
             // Request a summon of this window to the foreground
             SummonWindowRequested.raise(*this, nullptr);
 
-            const IInspectable unused{ nullptr };
-            _SetAsDefaultDismissHandler(unused, unused);
-
             // TEMPORARY SOLUTION
             // If the connection has requested for the window to be maximized,
             // manually maximize it here. Ideally, we should be _initializing_
@@ -4046,35 +4041,6 @@ namespace winrt::TerminalApp::implementation
         }
     }
 
-    // Method Description:
-    // - Displays a info popup guiding the user into setting their default terminal.
-    void TerminalPage::ShowSetAsDefaultInfoBar() const
-    {
-        if (::winrt::Windows::UI::Xaml::Application::Current().try_as<::winrt::TerminalApp::App>() == nullptr)
-        {
-            // Just ignore this in the tests (where the Application::Current()
-            // is not a TerminalApp::App)
-            return;
-        }
-        if (!CascadiaSettings::IsDefaultTerminalAvailable() || _IsMessageDismissed(InfoBarMessage::SetAsDefault))
-        {
-            return;
-        }
-
-        // If the user has already configured any terminal for hand-off we
-        // shouldn't inform them again about the possibility to do so.
-        if (CascadiaSettings::IsDefaultTerminalSet())
-        {
-            _DismissMessage(InfoBarMessage::SetAsDefault);
-            return;
-        }
-
-        if (const auto infoBar = FindName(L"SetAsDefaultInfoBar").try_as<MUX::Controls::InfoBar>())
-        {
-            infoBar.IsOpen(true);
-        }
-    }
-
     // Function Description:
     // - Helper function to get the OS-localized name for the "Touch Keyboard
     //   and Handwriting Panel Service". If we can't open up the service for any
@@ -4536,40 +4502,6 @@ namespace winrt::TerminalApp::implementation
         }
     }
 
-    // Method Description:
-    // - Persists the user's choice not to show the information bar warning about "Windows Terminal can be set as your default terminal application"
-    // Then hides this information buffer.
-    // Arguments:
-    // - <none>
-    // Return Value:
-    // - <none>
-    void TerminalPage::_SetAsDefaultDismissHandler(const IInspectable& /*sender*/, const IInspectable& /*args*/)
-    {
-        _DismissMessage(InfoBarMessage::SetAsDefault);
-        if (const auto infoBar = FindName(L"SetAsDefaultInfoBar").try_as<MUX::Controls::InfoBar>())
-        {
-            infoBar.IsOpen(false);
-        }
-
-        TraceLoggingWrite(g_hTerminalAppProvider, "SetAsDefaultTipDismissed", TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
-
-        _FocusCurrentTab(true);
-    }
-
-    // Method Description:
-    // - Dismisses the Default Terminal tip and opens the settings.
-    void TerminalPage::_SetAsDefaultOpenSettingsHandler(const IInspectable& /*sender*/, const IInspectable& /*args*/)
-    {
-        if (const auto infoBar = FindName(L"SetAsDefaultInfoBar").try_as<MUX::Controls::InfoBar>())
-        {
-            infoBar.IsOpen(false);
-        }
-
-        TraceLoggingWrite(g_hTerminalAppProvider, "SetAsDefaultTipInteracted", TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
-
-        OpenSettingsUI();
-    }
-
     // Method Description:
     // - Checks whether information bar message was dismissed earlier (in the application state)
     // Arguments:
diff --git a/src/cascadia/TerminalApp/TerminalPage.h b/src/cascadia/TerminalApp/TerminalPage.h
index 12c20a8056d..5e22760fc67 100644
--- a/src/cascadia/TerminalApp/TerminalPage.h
+++ b/src/cascadia/TerminalApp/TerminalPage.h
@@ -145,7 +145,6 @@ namespace winrt::TerminalApp::implementation
         winrt::TerminalApp::TaskbarState TaskbarState() const;
 
         void ShowKeyboardServiceWarning() const;
-        void ShowSetAsDefaultInfoBar() const;
         winrt::hstring KeyboardServiceDisabledText();
 
         winrt::fire_and_forget IdentifyWindow();
@@ -507,8 +506,6 @@ namespace winrt::TerminalApp::implementation
         winrt::fire_and_forget _ConnectionStateChangedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const;
         void _CloseOnExitInfoDismissHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const;
         void _KeyboardServiceWarningInfoDismissHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const;
-        void _SetAsDefaultDismissHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args);
-        void _SetAsDefaultOpenSettingsHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args);
         static bool _IsMessageDismissed(const winrt::Microsoft::Terminal::Settings::Model::InfoBarMessage& message);
         static void _DismissMessage(const winrt::Microsoft::Terminal::Settings::Model::InfoBarMessage& message);
 
diff --git a/src/cascadia/TerminalApp/TerminalPage.xaml b/src/cascadia/TerminalApp/TerminalPage.xaml
index 600ec505c67..c8aa837bf82 100644
--- a/src/cascadia/TerminalApp/TerminalPage.xaml
+++ b/src/cascadia/TerminalApp/TerminalPage.xaml
@@ -53,21 +53,6 @@
                             Click="_CloseOnExitInfoDismissHandler" />
                 </mux:InfoBar.ActionButton>
             </mux:InfoBar>
-
-            <mux:InfoBar x:Name="SetAsDefaultInfoBar"
-                         x:Uid="SetAsDefaultInfoBar"
-                         x:Load="False"
-                         CloseButtonClick="_SetAsDefaultDismissHandler"
-                         CornerRadius="0"
-                         IsClosable="True"
-                         IsIconVisible="True"
-                         IsOpen="False"
-                         Severity="Informational">
-                <mux:InfoBar.ActionButton>
-                    <HyperlinkButton x:Uid="SetAsDefaultTip_OpenSettingsLink"
-                                     Click="_SetAsDefaultOpenSettingsHandler" />
-                </mux:InfoBar.ActionButton>
-            </mux:InfoBar>
         </StackPanel>
 
         <Grid x:Name="TabContent"
diff --git a/src/cascadia/TerminalSettingsModel/ApplicationState.idl b/src/cascadia/TerminalSettingsModel/ApplicationState.idl
index 02856a4d2d7..e48c1e7f86b 100644
--- a/src/cascadia/TerminalSettingsModel/ApplicationState.idl
+++ b/src/cascadia/TerminalSettingsModel/ApplicationState.idl
@@ -7,9 +7,10 @@ namespace Microsoft.Terminal.Settings.Model
 {
     enum InfoBarMessage
     {
-        CloseOnExitInfo = 0,
+        // We need a sentinel value to map deleted keys to, as we can't actually delete them (GH#16874)
+        IgnoredDeprecatedEntry = 0,
+        CloseOnExitInfo,
         KeyboardServiceWarning,
-        SetAsDefault,
     };
 
     runtimeclass WindowLayout
diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h b/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h
index f5431aabf3d..f1f2bc11048 100644
--- a/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h
+++ b/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h
@@ -559,10 +559,13 @@ JSON_FLAG_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::IntenseStyle)
 
 JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::InfoBarMessage)
 {
-    JSON_MAPPINGS(3) = {
+    JSON_MAPPINGS(4) = {
+        pair_type{ "deprecated", ValueType::IgnoredDeprecatedEntry },
         pair_type{ "closeOnExitInfo", ValueType::CloseOnExitInfo },
         pair_type{ "keyboardServiceWarning", ValueType::KeyboardServiceWarning },
-        pair_type{ "setAsDefault", ValueType::SetAsDefault },
+
+        // Keep deprecated keys last, so when they get serialized again they aren't written out
+        pair_type{ "setAsDefault", ValueType::IgnoredDeprecatedEntry },
     };
 };
 


Test patch: