File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -268,7 +268,6 @@ impl PickerDelegate for CommandPaletteDelegate {
268268 }
269269
270270 fn dismissed ( & mut self , cx : & mut ViewContext < Picker < Self > > ) {
271- cx. focus ( & self . previous_focus_handle ) ;
272271 self . command_palette
273272 . update ( cx, |_, cx| cx. emit ( ModalEvent :: Dismissed ) )
274273 . log_err ( ) ;
Original file line number Diff line number Diff line change @@ -407,6 +407,10 @@ impl<'a> WindowContext<'a> {
407407
408408 /// Move focus to the element associated with the given `FocusHandle`.
409409 pub fn focus ( & mut self , handle : & FocusHandle ) {
410+ if self . window . focus == Some ( handle. id ) {
411+ return ;
412+ }
413+
410414 if self . window . last_blur . is_none ( ) {
411415 self . window . last_blur = Some ( self . window . focus ) ;
412416 }
Original file line number Diff line number Diff line change @@ -36,8 +36,9 @@ impl ModalLayer {
3636 let previous_focus = cx. focused ( ) ;
3737
3838 if let Some ( active_modal) = & self . active_modal {
39- if active_modal. modal . clone ( ) . downcast :: < V > ( ) . is_ok ( ) {
40- self . hide_modal ( cx) ;
39+ let is_close = active_modal. modal . clone ( ) . downcast :: < V > ( ) . is_ok ( ) ;
40+ self . hide_modal ( cx) ;
41+ if is_close {
4142 return ;
4243 }
4344 }
You can’t perform that action at this time.
0 commit comments