Merge pull request #1526 from mtkennerly/feature/find-focused

Add widget operation to find currently focused widget
This commit is contained in:
Héctor Ramón 2022-11-14 00:47:28 +01:00 committed by GitHub
commit 23364bc4a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 0 deletions

View file

@ -333,6 +333,12 @@ impl Id {
}
}
impl From<Id> for widget::Id {
fn from(id: Id) -> Self {
id.0
}
}
/// Produces a [`Command`] that focuses the [`TextInput`] with the given [`Id`].
pub fn focus<Message: 'static>(id: Id) -> Command<Message> {
Command::widget(operation::focusable::focus(id.0))