Skip to content

Fix IME keyobard state when search-only native input programatically hidden#9119

Open
LukasPaczos wants to merge 1 commit into
developfrom
fix/lpaczos/native-input-subs-cta-keyboard-visible
Open

Fix IME keyobard state when search-only native input programatically hidden#9119
LukasPaczos wants to merge 1 commit into
developfrom
fix/lpaczos/native-input-subs-cta-keyboard-visible

Conversation

@LukasPaczos

@LukasPaczos LukasPaczos commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

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

Description

Fixes regression from #8929 by extending a fix introduced in #8945 - it fixed the native input search-only state when a back button is used, but didn't apply the same fix for other programmatic sources that hide the native input widget.

Steps to test this PR

regression test: search path

  • Clean install the app and go through onboarding.
  • In the Serarch / Duck.ai input step keep search.
  • Finish onboarding.
  • Verify that on the last step ('You've got this') the keyboard is visible and the address bar is focused (no toggle).
  • Verify that after clicking 'High five' both the keyboard and native input widget are collapsed.

regression test: chat path

  • Clean install the app and go through onboarding.
  • In the Serarch / Duck.ai input select chat.
  • Finish onboarding.
  • Verify that on the last step ('You've got this') the keyboard is visible and the address bar is focused (with toggle).
  • Verify that after clicking 'High five' both the keyboard and native input widget are collapsed.

regression test: backing out from focused address

  • Focus the address bar.
  • Use back button.
  • Verify both the keyboard and native input widget are collapsed.
  • Go to Settings -> AI Features -> Select 'Search'-only.
  • Go back to browser.
  • Focus the address bar.
  • Use back button.
  • Verify both the keyboard and native input widget are collapsed.

regression test: backing out Duck.ai mode

  • Click Duck.ai icon on the address bar.
  • Click full-screen icon.
  • Focus the input field.
  • Use back button.
  • Verify both the keyboard and native input widget are collapsed.
  • Focus the input field.
  • Use the 'x' button in the top left.
  • Verify both the keyboard and native input widget are collapsed (and Duck.ai mode is closed).

Apply below patch:

diff --git a/app/src/main/java/com/duckduckgo/app/cta/ui/CtaViewModel.kt b/app/src/main/java/com/duckduckgo/app/cta/ui/CtaViewModel.kt
index 1233367d2b..c4ffb959f7 100644
--- a/app/src/main/java/com/duckduckgo/app/cta/ui/CtaViewModel.kt
+++ b/app/src/main/java/com/duckduckgo/app/cta/ui/CtaViewModel.kt
@@ -139,7 +139,7 @@ class CtaViewModel @Inject constructor(
     }
 
     private suspend fun isSubscriptionCtaAvailable(): Boolean =
-        subscriptions.isEligible() && hasNoSubscription() && extendedOnboardingFeatureToggles.privacyProCta().isEnabled()
+        true//subscriptions.isEligible() && hasNoSubscription() && extendedOnboardingFeatureToggles.privacyProCta().isEnabled()
 
     private suspend fun isBrandDesignUpdateEnabled(): Boolean = withContext(dispatchers.io()) {
         onboardingBrandDesignUpdateToggles.brandDesignUpdate().isEnabled()

test: search path with subscription

  • Clean install the app and go through onboarding.
  • In the Serarch / Duck.ai input step keep search.
  • Finish onboarding.
  • Verify that on the last step ('You've got this') the keyboard is visible and the address bar is focused (no toggle).
  • Verify that after clicking 'High five' both the keyboard and native input widget are collapsed.
  • Verify the subscription promo is visible.

test: chat path with subscription

  • Clean install the app and go through onboarding.
  • In the Serarch / Duck.ai input select chat.
  • Finish onboarding.
  • Verify that on the last step ('You've got this') the keyboard is visible and the address bar is focused (with toggle).
  • Verify that after clicking 'High five' both the keyboard and native input widget are collapsed.
  • Verify the subscription promo is visible.

Note

Low Risk
Small, localized IME/focus ordering change in native input teardown with no auth, data, or security impact.

Overview
Fixes a regression where the soft keyboard could pop back up after the native input widget was dismissed programmatically in search-only mode, because the EditText still held IME focus.

clearInputFocus() now runs at the start of hideNativeInput() for every dismissal path (onboarding CTAs, submit/navigation, feature toggles, etc.), not only when the widget’s back handler runs. That matches the earlier back-button fix and stops the window from re-requesting the keyboard after hide. In search-and-Duck.ai mode the field is usually already unfocused, so this is effectively a no-op there.

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

@LukasPaczos

Copy link
Copy Markdown
Contributor Author

I'm now noticing that the issue doesn't occur when toggle is enabled. It only occurs in search-only mode. I'll investigate further.

@LukasPaczos
LukasPaczos marked this pull request as draft July 8, 2026 09:49
@LukasPaczos
LukasPaczos force-pushed the fix/lpaczos/native-input-subs-cta-keyboard-visible branch from 761a242 to 82adfee Compare July 8, 2026 10:20
@LukasPaczos
LukasPaczos force-pushed the fix/lpaczos/native-input-subs-cta-keyboard-visible branch from 82adfee to 2e875a4 Compare July 8, 2026 10:28
@LukasPaczos
LukasPaczos marked this pull request as ready for review July 8, 2026 10:28
@LukasPaczos

Copy link
Copy Markdown
Contributor Author

This is ready for review.

@LukasPaczos LukasPaczos changed the title Request focus dummy to hide keyboard when dropping native input focus Fix IME keyobard state when search-only native input programatically hidden Jul 8, 2026
@LukasPaczos

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 2e875a4. Configure here.

@malmstein malmstein removed their assignment Jul 17, 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.

2 participants