weather: now, the next 24 hours and the week
git clone https://git.lucas.co/cce-weather.git
refactor(focus): drive focus through UiContext::focus_widget / unfocus_widget
A direct w.focus() / w.unfocus() left the window's record of focus (the Tab
walk, the accessibility tree) behind: on a widget that had let go, or beside
a newly focused one. The UiContext helpers do what the direct call did and
keep the record in step (cce-ui's global-state RFC, phase 2).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
src/main.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index cfe853d..c189739 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -273,7 +273,7 @@ impl WeatherApp {
if self.results_btns[i].take_click() {
if let Some(loc) = self.results.get(i).cloned() {
self.clear_search();
- self.search.unfocus();
+ self.ui_context.unfocus_widget(&mut self.search);
self.set_location(loc);
}
}
@@ -727,7 +727,7 @@ impl Application for WeatherApp {
// One match needs no question.
Ok(mut list) if list.len() == 1 => {
self.clear_search();
- self.search.unfocus();
+ self.ui_context.unfocus_widget(&mut self.search);
self.set_location(list.remove(0));
}
Ok(list) => self.results = list,
@@ -902,7 +902,7 @@ impl Application for WeatherApp {
}
Key::Named(NamedKey::Escape) if self.picking() || self.search.editing => {
self.results.clear();
- self.search.unfocus();
+ self.ui_context.unfocus_widget(&mut self.search);
self.needs_rebuild = true;
*needs_rebuild = true;
return None;