git.lucas.co / cce-graph
node-based graph editor
git clone https://git.lucas.co/cce-graph.git

commit25f06f4c7122bfe5ce762b64d32e6664c5fee279
parentfb138c5ac5
authorLucas Galante <lsgalante12@gmail.com>
date2026-10-08 12:34
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/vault.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/vault.rs b/src/vault.rs
index 337854d..1af073b 100644
--- a/src/vault.rs
+++ b/src/vault.rs
@@ -744,7 +744,7 @@ impl Application for VaultApp {
             return None;
         }
         if pressed && self.filter_input.editing {
-            self.filter_input.unfocus();
+            self.ui_context.unfocus_widget(&mut self.filter_input);
         }
         if pressed && button == MouseButton::Left {
             if m.global_chip.contains(s.0, s.1) {
@@ -818,7 +818,7 @@ impl Application for VaultApp {
         let pressed = event.state == ElementState::Pressed;
         if self.filter_input.editing {
             if pressed && matches!(event.logical_key, Key::Named(NamedKey::Escape)) {
-                self.filter_input.unfocus();
+                self.ui_context.unfocus_widget(&mut self.filter_input);
                 return None;
             }
             let ev = Event::KeyInput(event.clone());