Skip to content

Fix keyboard reappearing on search-only back#8945

Merged
malmstein merged 1 commit into
developfrom
feature/david/search_only_keyboard_back
Jun 22, 2026
Merged

Fix keyboard reappearing on search-only back#8945
malmstein merged 1 commit into
developfrom
feature/david/search_only_keyboard_back

Conversation

@malmstein

@malmstein malmstein commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Task/Issue URL: https://app.asana.com/1/137249556945/project/1204912272578138/task/1215751565522437?focus=true
Tech Design URL (if applicable):

Description

With native input enabled and the Search Only address-bar option selected, focusing the input field and pressing the top-left back arrow hid the keyboard but it immediately popped back up. Search & Duck.ai worked as expected.

Root cause: the native input onBack handler called hideKeyboard() but never cleared focus. In SEARCH_ONLY mode the input field still holds focus when Back is pressed, so a focused, still-attached EditText remains the IME target and the window re-requests the keyboard right after the hide. In SEARCH_AND_DUCK_AI the field had already lost focus, so the hide stuck — which is why only Search Only was affected.

Fix: clear the input field's focus before hiding the IME in the back handler, so there's no editor for the window to re-show the keyboard for. It's a no-op in SEARCH_AND_DUCK_AI where focus is already gone.

Confirmed on-device with temporary instrumentation (since removed). In Search Only, the dismiss trace went from hideKeyboard: focus=true / onHide: focus=inputField (keyboard returns) to hideKeyboard: focus=false / onHide: focus=null (keyboard stays down), matching the working Search & Duck.ai trace.

Steps to test this PR

Search Only (the fix)

  • Settings → AI Features → select Search Only
  • On the NTP (or any page), tap the address bar to open the native input; the keyboard appears
  • Tap the top-left back arrow
  • Verify you return to the NTP / previous page and the keyboard stays hidden (does not pop back up)

Search & Duck.ai (regression)

  • Settings → AI Features → select Search & Duck.ai
  • Open the native input, then tap the back arrow
  • Verify the keyboard hides and you return to the NTP / previous page as before

UI changes

No visual changes — keyboard dismissal behavior only. Verified on emulator (API 37) in both address-bar modes.


Note

Low Risk
Single-line behavioral change in the back handler using an existing widget API; no auth, data, or broad refactors.

Overview
Fixes the keyboard popping back up after tapping the native input’s top-left back control when Search Only is selected.

The onBack handler in NativeInputManager now calls clearInputFocus() before hideKeyboard() and closing the widget. In Search Only the field still had focus on Back, so the window kept treating the EditText as the IME target and re-requested the keyboard right after hide. Dropping focus first removes that target so dismissal sticks. Search & Duck.ai was unaffected (focus was already gone); clearInputFocus() is a no-op there.

Reviewed by Cursor Bugbot for commit 9bcac4c. Bugbot is set up for automated code reviews on this repo. Configure here.

When the native input is dismissed via the back arrow in SEARCH_ONLY
mode, the keyboard would hide and then immediately reappear. In that
mode the input field still holds focus when Back is pressed, so a
focused, still-attached EditText remains the IME target and the window
re-requests the keyboard right after the hide. SEARCH_AND_DUCK_AI was
unaffected because the field had already lost focus by then.

Clear the input field's focus before hiding the IME in the back
handler so there is no editor for the window to re-show the keyboard
for. This is a no-op in SEARCH_AND_DUCK_AI where focus is already gone.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@joshliebe joshliebe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected!

@malmstein malmstein merged commit 65d8602 into develop Jun 22, 2026
32 checks passed
@malmstein malmstein deleted the feature/david/search_only_keyboard_back branch June 22, 2026 20:12
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.

2 participants