Skip to content

Focus: preserve Entry across commits when focus stays on the same node - #1316

Merged
Hona merged 1 commit into
devfrom
screens-b-focus-keep-entry
Nov 21, 2026
Merged

Hona merged 1 commit into
devfrom
screens-b-focus-keep-entry

Conversation

@Hona

@Hona Hona commented Nov 21, 2026

Copy link
Copy Markdown
Member

Fixes a bug where sync_requested_focus (crates/rune/src/runtime/input/focus.rs:528-536) promoted Entry::Other to Entry::Keys on every commit after an in-field arrow / Home / End key (FocusEvent::Navigated) or FocusEvent::WindowReturned, turning on El::focus_visible_within_ring even though focus never moved to a new element.

Root cause

  • FocusState::entry (focus_machine.rs:22-25) is meant to stay Entry::Other when an arrow key is pressed inside a field that a pointer click focused (FocusEvent::Navigated flips modality to Keyboard, leaving entry untouched).
  • On the next commit, sync_requested_focus passed keyboard = self.kbd.focus.keyboard() (true) into set_focus(app, next, keyboard) -> FocusEvent::Set { path, keyboard }, unconditionally overwriting self.entry with Entry::Keys even when focus stayed on the same node without an explicit Tx::focus.

Fix

  • Add keep_entry: bool to FocusEvent::Set and set_focus_entry, set to true in sync_requested_focus when asked did not target next and next.as_deref() == self.kbd.focus.path().
  • Explicit Tx::focus(key, ring) calls, pointer clicks, Tab, F6, and focus moves to another node still update Entry as before.

Verified with tools\cargo.ps1 check -p rune --lib --tests (0 errors, 0 new warnings).

@Hona
Hona merged commit 8283dca into dev Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant