Unfocus grid item on escape
This commit is contained in:
parent
7a96f51cbe
commit
2472f9909b
2 changed files with 6 additions and 1 deletions
|
|
@ -677,7 +677,12 @@ impl Application for App {
|
||||||
return Command::none();
|
return Command::none();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let had_focused_button = tab.select_focus_id().is_some();
|
||||||
if tab.select_none() {
|
if tab.select_none() {
|
||||||
|
if had_focused_button {
|
||||||
|
// Unfocus if there was a focused button
|
||||||
|
return widget::button::focus(widget::Id::unique());
|
||||||
|
}
|
||||||
return Command::none();
|
return Command::none();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -743,7 +743,7 @@ impl Tab {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn select_focus_id(&self) -> Option<widget::Id> {
|
pub fn select_focus_id(&self) -> Option<widget::Id> {
|
||||||
let items = self.items_opt.as_ref()?;
|
let items = self.items_opt.as_ref()?;
|
||||||
let item = items.get(self.select_focus?)?;
|
let item = items.get(self.select_focus?)?;
|
||||||
Some(item.button_id.clone())
|
Some(item.button_id.clone())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue