From 9057eaec7e4a68fb018affbe8f053bd89267079c Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 13 Nov 2020 12:50:05 +0100 Subject: [PATCH] Fix: you can again click slider values to edit them --- egui/src/memory.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/egui/src/memory.rs b/egui/src/memory.rs index 4d811f51..ac912279 100644 --- a/egui/src/memory.rs +++ b/egui/src/memory.rs @@ -136,7 +136,11 @@ impl Memory { self.areas.end_frame(); if let Some(kb_focus_id) = self.interaction.kb_focus_id { - if !self.used_ids.contains_key(&kb_focus_id) { + // Allow calling `request_kb_focus` one frame and not using it until next frame + let recently_gained_kb_focus = + self.interaction.kb_focus_id_previous_frame != Some(kb_focus_id); + + if !recently_gained_kb_focus && !self.used_ids.contains_key(&kb_focus_id) { // Dead-mans-switch: the widget with kb focus has dissappeared! self.interaction.kb_focus_id = None; }