Avoid losing focus when block decorations go offscreen (#14815)

Release Notes:

- Fixed a bug that caused focus to be lost when renames and inline
assists were scrolled offscreen.

---------

Co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra
2024-07-19 17:04:18 +02:00
committed by GitHub
co-authored by Nathan
parent f5d50f2b1e
commit d61eaea4b9
18 changed files with 941 additions and 584 deletions
+3 -3
View File
@@ -1359,6 +1359,9 @@ impl Interactivity {
f: impl FnOnce(&Style, Point<Pixels>, Option<Hitbox>, &mut WindowContext) -> R,
) -> R {
self.content_size = content_size;
if let Some(focus_handle) = self.tracked_focus_handle.as_ref() {
cx.set_focus_handle(&focus_handle);
}
cx.with_optional_element_state::<InteractiveElementState, _>(
global_id,
|element_state, cx| {
@@ -1998,9 +2001,6 @@ impl Interactivity {
if let Some(context) = self.key_context.clone() {
cx.set_key_context(context);
}
if let Some(focus_handle) = self.tracked_focus_handle.as_ref() {
cx.set_focus_handle(focus_handle);
}
for listener in key_down_listeners {
cx.on_key_event(move |event: &KeyDownEvent, phase, cx| {