Unfocus TextInput if it becomes disabled

This commit is contained in:
Héctor Ramón Jiménez 2023-04-12 04:20:04 +02:00
parent 250ba3a7f1
commit 7e69cb4b18
No known key found for this signature in database
GPG key ID: 140CC052C94F138E

View file

@ -227,6 +227,18 @@ where
tree::State::new(State::new())
}
fn diff(&self, tree: &mut Tree) {
let state = tree.state.downcast_mut::<State>();
// Unfocus text input if it becomes disabled
if self.on_input.is_none() {
state.last_click = None;
state.is_focused = None;
state.is_pasting = None;
state.is_dragging = false;
}
}
fn width(&self) -> Length {
self.width
}