diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Pages/ShellPage.xaml.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/Pages/ShellPage.xaml.cs index 0c821dda5c..69ba8b0bef 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Pages/ShellPage.xaml.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Pages/ShellPage.xaml.cs @@ -586,12 +586,13 @@ public sealed partial class ShellPage : Microsoft.UI.Xaml.Controls.Page, if (shouldSearchBoxBeVisible || page is not ContentPage) { + ViewModel.IsSearchBoxVisible = shouldSearchBoxBeVisible; + if (HostWindow?.IsVisibleToUser != true) { return; } - ViewModel.IsSearchBoxVisible = shouldSearchBoxBeVisible; SearchBox.Focus(FocusState.Programmatic); SearchBox.SelectSearch(); }