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 {
268
268
}
269
269
270
270
fn dismissed ( & mut self , cx : & mut ViewContext < Picker < Self > > ) {
271
- cx. focus ( & self . previous_focus_handle ) ;
272
271
self . command_palette
273
272
. update ( cx, |_, cx| cx. emit ( ModalEvent :: Dismissed ) )
274
273
. log_err ( ) ;
Original file line number Diff line number Diff line change @@ -407,6 +407,10 @@ impl<'a> WindowContext<'a> {
407
407
408
408
/// Move focus to the element associated with the given `FocusHandle`.
409
409
pub fn focus ( & mut self , handle : & FocusHandle ) {
410
+ if self . window . focus == Some ( handle. id ) {
411
+ return ;
412
+ }
413
+
410
414
if self . window . last_blur . is_none ( ) {
411
415
self . window . last_blur = Some ( self . window . focus ) ;
412
416
}
Original file line number Diff line number Diff line change @@ -36,8 +36,9 @@ impl ModalLayer {
36
36
let previous_focus = cx. focused ( ) ;
37
37
38
38
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 {
41
42
return ;
42
43
}
43
44
}
You can’t perform that action at this time.
0 commit comments