git.lucas.co / cce-text-editor
text editor
git clone https://git.lucas.co/cce-text-editor.git

commit623c37395f3526d2abe993c403f651ec568fcc27
parent62826cbe66
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/main.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main.rs b/src/main.rs
index 3cbefb0..d7e55dc 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -552,7 +552,7 @@ impl Application for TextEditorApp {
         } else if self.ui_context.propagate_event(&ev, editor) {
             changed = true;
         } else if state == ElementState::Pressed && button == MouseButton::Left {
-            self.editor.unfocus();
+            self.ui_context.unfocus_widget(&mut self.editor);
             changed = true;
         }