diff --git a/egui/src/response.rs b/egui/src/response.rs index f1965eeb..1a0bd560 100644 --- a/egui/src/response.rs +++ b/egui/src/response.rs @@ -60,7 +60,7 @@ pub struct Response { /// `None` if the widget is not being interacted with. pub(crate) interact_pointer_pos: Option, - /// This widget has the keyboard focus (i.e. is receiving key pressed). + /// This widget has the keyboard focus (i.e. is receiving key presses). pub(crate) has_kb_focus: bool, /// The widget had keyboard focus and lost it. @@ -145,6 +145,11 @@ impl Response { self.hovered } + /// This widget has the keyboard focus (i.e. is receiving key presses). + pub fn has_kb_focus(&self) -> bool { + self.has_kb_focus + } + /// The widget had keyboard focus and lost it, /// perhaps because the user pressed enter. /// If you want to do an action when a user presses enter in a text field,