Skip to content

Keep autocomplete from stealing editor focus#12

Open
adamsardo wants to merge 1 commit into
Mudlet:masterfrom
adamsardo:codex/autocomplete-no-focus-steal
Open

Keep autocomplete from stealing editor focus#12
adamsardo wants to merge 1 commit into
Mudlet:masterfrom
adamsardo:codex/autocomplete-no-focus-steal

Conversation

@adamsardo
Copy link
Copy Markdown

@adamsardo adamsardo commented May 9, 2026

Addresses Mudlet/Mudlet#5310.
/claim #5310
/claim Mudlet/Mudlet#5310

Summary:

  • keep the editor component as the focused widget while autocomplete is visible
  • make the popup menu/list non-focus widgets and avoid activating the popup window
  • route editor-origin navigation keys to the autocomplete list, while normal typing/backspace continues through the editor
  • preserve legacy popup/list key handling with a recursion guard for forwarded events
  • add an autocomplete focus regression test that opens suggestions, types through the editor, and verifies the list does not receive focus

This is intentionally different from #11: it does not call editorComponentRef_->setFocus() when autocomplete closes, so it should not steal focus back if the user already moved focus to another non-edbee widget.

Proof:

Autocomplete focus proof

The proof GIF is generated from the actual edbee widget. It shows autocomplete opening, Down arrow changing the list selection, and a typed p being inserted into the editor while editor focus remains active and the autocomplete list does not receive focus.

Verification:

  • git diff --check
  • cmake -S . -B build/codex-qt5 -DBUILD_WITH_QT5=ON -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/qt@5 -DCMAKE_BUILD_TYPE=Debug
  • cmake --build build/codex-qt5 --parallel 6
  • QT_QPA_PLATFORM=offscreen ./build/codex-qt5/edbee-test/edbee-test (784 passed, 0 failures)

@adamsardo adamsardo force-pushed the codex/autocomplete-no-focus-steal branch from 0920880 to 93c74cd Compare May 9, 2026 15:53
@adamsardo
Copy link
Copy Markdown
Author

Added the missing proof artifact to the PR body: a GIF generated from the actual edbee widget showing autocomplete open while editor focus remains active, Down arrow routing selection to the list, and normal typing still landing in the editor.

I also added the focused regression test to edbee-test; local Qt 5.15.18/offscreen run is now 784 passed, 0 failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants