git.lucas.co / cce-data-editor
structured data editor
git clone https://git.lucas.co/cce-data-editor.git

commit21662784d384630b4e4fa4b934374639fbdbaecf
parent73721a375d
authorLucas Galante <[email protected]>
date2026-07-28 23:31
fix: claim ctx focus for the raw editor on click

TextBox handles clicks without claiming ctx focus, so focus stayed on
the TreeList after clicking into the raw pane and the tree's new focus
rim never cleared. Claim it in the raw-editor press branch: the tree
gets FocusOut and its rim goes out.

Co-Authored-By: Claude Fable 5 <[email protected]>

 src/main.rs | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/main.rs b/src/main.rs
index 5be9fc7..2dfd4be 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1786,6 +1786,9 @@ impl Application for DataEditorApp {
             editor_handled = true;
 
             if button == MouseButton::Left && state == ElementState::Pressed {
+                // TextBox handles the click without claiming ctx focus; claim it
+                // here so the tree gets FocusOut and its focus rim clears.
+                self.ui_context.set_focused(&mut self.raw_json_editor);
                 let cursor_offset = self.raw_json_editor.cursor_idx;
                 let content = if self.raw_json_editor.editing { &self.raw_json_editor.edit_buffer } else { &self.raw_json_editor.text };