text editor
git clone https://git.lucas.co/cce-text-editor.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 | 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;
}