Closed Bug 1400878 Opened 2 years ago Closed 2 years ago

Don't popup keyboard when input focused without user interaction

Categories

(Firefox for Android :: Keyboards and IME, defect)

defect
Not set

Tracking

()

VERIFIED FIXED
Firefox 57
Tracking Status
firefox57 --- verified

People

(Reporter: snorp, Assigned: snorp)

References

Details

Attachments

(1 file)

This seems to be the way other browser work these days. Also, it prevents us from running the Speedometer benchmark without constant keyboard changes.
Comment on attachment 8909332 [details]
Bug 1400878 - Don't show keyboard on Android unless the user caused it

https://reviewboard.mozilla.org/r/180888/#review186078

::: widget/android/GeckoEditableSupport.cpp:1159
(Diff revision 1)
>      if (aContext.mIMEState.mEnabled != IMEState::DISABLED &&
> -        aContext.mIMEState.mEnabled != IMEState::PLUGIN &&
> +        !aAction.IsUserAction() &&
> -        Preferences::GetBool("content.ime.strict_policy", false) &&
> -        !aAction.ContentGotFocusByTrustedCause() &&
>          !aAction.UserMightRequestOpenVKB()) {
>          return;

We won't properly initialize the Java side code if we early return here. We should just not call `showSoftInput` here [1] if a script causes us to focus, maybe by passing a flag into `notifyIMEContext` [2].

[1] http://searchfox.org/mozilla-central/rev/05c4c3bc0cfb9b0fc66bdfc8c47cac674e45f151/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoInputConnection.java#649
[2] http://searchfox.org/mozilla-central/rev/05c4c3bc0cfb9b0fc66bdfc8c47cac674e45f151/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoInputConnection.java#971
Attachment #8909332 - Flags: review?(nchen) → review-
Comment on attachment 8909332 [details]
Bug 1400878 - Don't show keyboard on Android unless the user caused it

https://reviewboard.mozilla.org/r/180888/#review186270

::: widget/android/GeckoEditableSupport.cpp:1155
(Diff revision 2)
> -        !aAction.ContentGotFocusByTrustedCause() &&
> -        !aAction.UserMightRequestOpenVKB()) {
> -        return;
> -    }
> -
>      IMEState::Enabled enabled = aContext.mIMEState.mEnabled;

You can actually get rid of `enabled` now

::: widget/android/GeckoEditableSupport.cpp:1159
(Diff revision 2)
> -    }
> -
>      mInputContext = aContext;
>      mInputContext.mIMEState.mEnabled = enabled;
>  
> -    if (enabled == IMEState::ENABLED && aAction.UserMightRequestOpenVKB()) {
> +    if (enabled == IMEState::ENABLED && aAction.UserMightRequestOpenVKB() && aAction.IsUserAction()) {

`UserMightRequestOpenVKB()` already implies `IsUserAction()`
Attachment #8909332 - Flags: review?(nchen) → review+
Duplicate of this bug: 1399067
Duplicate of this bug: 717361
Duplicate of this bug: 792191
Pushed by jwillcox@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/7e16f505b25f
Don't show keyboard on Android unless the user caused it r=jchen
https://hg.mozilla.org/mozilla-central/rev/7e16f505b25f
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 57
Verified as fixed on latest Nightly build with Huawei Honor (Android 5.1.1), Honor 8 (Android 7.0) and Asus ZenPad 8(Android 6.0.1).
Status: RESOLVED → VERIFIED
Verified also on today's Nightly on Nexus 6p / Android Oreo. Thank you!
Assignee: nobody → snorp
Depends on: 1402461
Blocks: 1402461
No longer depends on: 1402461
Blocks: 1409113
No longer blocks: 1409113
Depends on: 1409113
You need to log in before you can comment on or make changes to this bug.