This commit is contained in:
Conrad Irwin 2023-11-09 20:58:35 -07:00
parent ff15ddf3e0
commit 77d92ff65a
6 changed files with 134 additions and 62 deletions

View file

@ -146,6 +146,11 @@ impl FocusHandle {
}
}
/// Moves the focus to the element associated with this handle.
pub fn focus(&self, cx: &mut WindowContext) {
cx.focus(self)
}
/// Obtains whether the element associated with this handle is currently focused.
pub fn is_focused(&self, cx: &WindowContext) -> bool {
self.id.is_focused(cx)