@@ -602,16 +602,26 @@ public void SwitchToCommandPaletteMode()
602602 OmnibarCurrentSelectedModeName = OmnibarPaletteModeName ;
603603 }
604604
605- public void SwitchToSearchMode ( )
605+ public async Task SwitchToSearchMode ( )
606606 {
607+ // If the Omnibar is already focused such as when the user initiates a search via the Command Palette,
608+ // add a short delay to allow the Command Palette to fully close before switching modes.
609+ var omnibar = AddressToolbar ? . FindDescendant ( "Omnibar" ) as Omnibar ;
610+ if ( omnibar is not null && omnibar . IsFocused )
611+ await Task . Delay ( 100 ) ;
612+
607613 OmnibarCurrentSelectedModeName = OmnibarSearchModeName ;
608614 }
609615
610- public void SwitchToPathMode ( )
616+ public async Task SwitchToPathMode ( )
611617 {
612- OmnibarCurrentSelectedModeName = OmnibarPathModeName ;
613-
618+ // If the Omnibar is already focused such as when the user initiates the Edit Path action via the
619+ // Command Palette, add a short delay to allow the Command Palette to fully close before switching modes.
614620 var omnibar = AddressToolbar ? . FindDescendant ( "Omnibar" ) as Omnibar ;
621+ if ( omnibar is not null && omnibar . IsFocused )
622+ await Task . Delay ( 100 ) ;
623+
624+ OmnibarCurrentSelectedModeName = OmnibarPathModeName ;
615625 omnibar ? . Focus ( FocusState . Programmatic ) ;
616626 omnibar . IsFocused = true ;
617627 }
@@ -997,8 +1007,7 @@ await Task.Run(() =>
9971007 HotKeys = command . HotKeys ,
9981008 SearchText = OmnibarCommandPaletteModeText ,
9991009 } )
1000- . Where ( item => item . Text != Commands . OpenCommandPalette . Description . ToString ( )
1001- && item . Text != Commands . EditPath . Description . ToString ( ) ) ;
1010+ . Where ( item => item . Text != Commands . OpenCommandPalette . Description . ToString ( ) ) ;
10021011 } ) ;
10031012
10041013 newSuggestions . AddRange ( suggestionItems ) ;
0 commit comments