File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/Files.App/UserControls Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -309,7 +309,22 @@ await DialogDisplayHelper.ShowDialogAsync(Strings.InvalidCommand.GetLocalizedRes
309309 }
310310 else if ( Omnibar . CurrentSelectedMode == OmnibarSearchMode )
311311 {
312- ContentPageContext . ShellPage ? . SubmitSearch ( args . Text ) ;
312+ var shellPage = ContentPageContext . ShellPage ;
313+
314+ if ( args . Item is SuggestionModel item && ! string . IsNullOrWhiteSpace ( item . ItemPath ) && shellPage is not null )
315+ await NavigationHelpers . OpenPath ( item . ItemPath , shellPage ) ;
316+ else
317+ {
318+ var searchQuery = args . Item is SuggestionModel x && ! string . IsNullOrWhiteSpace ( x . Name )
319+ ? x . Name
320+ : args . Text ;
321+
322+ shellPage ? . SubmitSearch ( searchQuery ) ; // use the resolved shellPage for consistency
323+ ViewModel . SaveSearchQueryToList ( searchQuery ) ;
324+ }
325+
326+ ( MainPageViewModel . SelectedTabItem ? . TabItemContent as Control ) ? . Focus ( FocusState . Programmatic ) ;
327+ return ;
313328 }
314329 }
315330
You can’t perform that action at this time.
0 commit comments