webview should not hide keyboard when losing focus |
|||||||||
Issue descriptionSTEPS TO REPRODUCE: 1. Open Compose in Inbox 2. Set focus on the Body 3. Move focus on the Subject EXPECTED RESULTS: The soft keyboard stays open OBSERVED RESULTS: Sometimes, the soft keyboard tries to close, then open right back up. Originally filed as b/29402905 We may need to hide keyboard in certain situations for Chrome, so it should be carefully removed. Also note that when moving focus from WebView to a focusable button, we won't hide keyboard. This is a small Android quirk for which I couldn't change the current behavior, but yes, it's more important to avoid blinking for normal cases.
,
Aug 19 2016
This bug has a label marking it high priority on http://b/29402905 , so let's get it into M54. yabinh@, please look into this ahead of your less urgent tasks.
,
Aug 19 2016
If we keep keyboard, we will get 1 test failure: ContentViewCoreFocusTest#testHideImeOnLosingFocus In fact, the only purpose of the failed test is to confirm that IME window should be hidden from the content view when the content view loses its focus. I think we should change the failed test if we consider it a bug.
,
Aug 19 2016
Please check #0. This is an expected behavior on Chrome that we need to fix.
,
Aug 22 2016
The scenario in #0 is transferring focus from a WebView textbox to an Android native textbox. We would like to preserve the keyboard showing in that case. But in other cases where the WebView textbox simply lost focus with no replacement, we of course still want to hide the keyboard (which is what testHideImeOnLosingFocus is testing). I'm not sure exactly how to detect the difference from the WebView. I think we could check https://developer.android.com/reference/android/view/inputmethod/InputMethodManager.html#isActive() at an appropriate time and only hide if it returns false. The main difficulty would be to determine the appropriate time. As an initial prototype to test viability, a fixed 500ms timeout would probably work. But I'd rather not land that if at all possible. We should take a close look at all possible listeners and events in the Android APIs we could wait on instead of a fixed timer, I haven't found a good one yet but there's probably something.
,
Aug 23 2016
I realized TextViews themselves must have the same problem. Looking at https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/widget/TextView.java , there is quite a lot of logic around hiding/focus. We should take the time to understand how it avoids the same bug when going from TextView -> TextView or TextView -> WebView, then apply the same approach.
,
Aug 23 2016
In normal cases when View focus moves from focusable to non-focusable components, Android's IMM automatically dismisses the keyboard (except for some small corner cases). The current mechanism in ImeAdapter is actually only needed for Chrome, if I remember correctly. When I wrote testHideImeOnLosingFocus I had the following test case in mind: 1. Launch a Chrome on tablet. 2. Activate input on one tab. 3. Open another tab. --> The input should be hidden. Chrome should hide keyboard in this case because Android View focus hasn't changed. There may be some other cases affected by the behavior change, but I haven't fully tested them myself.
,
Aug 23 2016
Re #6, that's a good point. I think we should also be extra careful about navigation cases.
,
Aug 23 2016
OK, it sounds like we could simply not run our special ImeAdapter hiding logic at all if we're in a WebView, which is easier than I thought. Perhaps to more elegantly solve #7 we should be switching to having a different Android View per tab instead of reusing the same one so that things like this Just Work? This is tied to some of the browser refactoring ideas.
,
Sep 21 2016
Punting to 55 because the launch train for http://b/29402905 is delayed due to missing spellcheck support.
,
Oct 10 2016
FYI, b/31975065 seems also related to this behavior.
,
Oct 27 2016
Also, b/32373760 seems to be the same issue.
,
Nov 3 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/66d5ae12299e85269251cd655d46a7b5710b7c80 commit 66d5ae12299e85269251cd655d46a7b5710b7c80 Author: yabinh <yabinh@chromium.org> Date: Thu Nov 03 05:49:32 2016 Make WebView keep keyboard when losing focus WebView should not hide keyboard when losing focus. As for Chrome, it should keep current behavior. These cases include when the ContentView is hidden (closing current tab, opening a new tab, switching to an existing tab), and when imeAdapter is attached to its native counterpart(navigation). Note that this CL will change one behavior of Chrome: keyboard will not be hidden when focus moves from ContentView to UrlBar. BUG= 636237 Review-Url: https://codereview.chromium.org/2290133002 Cr-Commit-Position: refs/heads/master@{#429531} [modify] https://crrev.com/66d5ae12299e85269251cd655d46a7b5710b7c80/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java [modify] https://crrev.com/66d5ae12299e85269251cd655d46a7b5710b7c80/chrome/test/data/android/tabstest/tabs_test.html [modify] https://crrev.com/66d5ae12299e85269251cd655d46a7b5710b7c80/content/public/android/BUILD.gn [modify] https://crrev.com/66d5ae12299e85269251cd655d46a7b5710b7c80/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java [delete] https://crrev.com/92cc84f200b7839f220a26633f1ba8983ea361aa/content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreFocusTest.java [modify] https://crrev.com/66d5ae12299e85269251cd655d46a7b5710b7c80/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java [modify] https://crrev.com/66d5ae12299e85269251cd655d46a7b5710b7c80/content/test/data/android/input/input_forms.html
,
Nov 8 2016
,
Nov 8 2016
Your change meets the bar and is auto-approved for M55 (branch: 2883)
,
Nov 9 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/cd665343ae016f7aa817553648a6620186a65d50 commit cd665343ae016f7aa817553648a6620186a65d50 Author: Alexandre Elias <aelias@chromium.org> Date: Tue Nov 08 23:59:56 2016 Make WebView keep keyboard when losing focus WebView should not hide keyboard when losing focus. As for Chrome, it should keep current behavior. These cases include when the ContentView is hidden (closing current tab, opening a new tab, switching to an existing tab), and when imeAdapter is attached to its native counterpart(navigation). Note that this CL will change one behavior of Chrome: keyboard will not be hidden when focus moves from ContentView to UrlBar. BUG= 636237 Review URL: https://codereview.chromium.org/2485573008 . Review-Url: https://codereview.chromium.org/2290133002 Cr-Original-Commit-Position: refs/heads/master@{#429531} Cr-Commit-Position: refs/branch-heads/2883@{#499} Cr-Branched-From: 614d31daee2f61b0180df403a8ad43f20b9f6dd7-refs/heads/master@{#423768} [modify] https://crrev.com/cd665343ae016f7aa817553648a6620186a65d50/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java [modify] https://crrev.com/cd665343ae016f7aa817553648a6620186a65d50/chrome/test/data/android/tabstest/tabs_test.html [modify] https://crrev.com/cd665343ae016f7aa817553648a6620186a65d50/content/public/android/BUILD.gn [modify] https://crrev.com/cd665343ae016f7aa817553648a6620186a65d50/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java [delete] https://crrev.com/69cba6427c6cc679855739eda4e3311473cfa5ba/content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreFocusTest.java [modify] https://crrev.com/cd665343ae016f7aa817553648a6620186a65d50/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java [modify] https://crrev.com/cd665343ae016f7aa817553648a6620186a65d50/content/test/data/android/input/input_forms.html
,
Nov 9 2016
,
Nov 9 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5eb1019b22b646ee388bbecec17d5af17c3bb339 commit 5eb1019b22b646ee388bbecec17d5af17c3bb339 Author: Alex Mineer <amineer@chromium.org> Date: Wed Nov 09 05:23:56 2016 Revert "Make WebView keep keyboard when losing focus" This reverts commit cd665343ae016f7aa817553648a6620186a65d50. Breaks build BUG= 636237 ,663622 Cr-Commit-Position: refs/branch-heads/2883@{#502} Cr-Branched-From: 614d31daee2f61b0180df403a8ad43f20b9f6dd7-refs/heads/master@{#423768} [modify] https://crrev.com/5eb1019b22b646ee388bbecec17d5af17c3bb339/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java [modify] https://crrev.com/5eb1019b22b646ee388bbecec17d5af17c3bb339/chrome/test/data/android/tabstest/tabs_test.html [modify] https://crrev.com/5eb1019b22b646ee388bbecec17d5af17c3bb339/content/public/android/BUILD.gn [modify] https://crrev.com/5eb1019b22b646ee388bbecec17d5af17c3bb339/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java [add] https://crrev.com/5eb1019b22b646ee388bbecec17d5af17c3bb339/content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreFocusTest.java [modify] https://crrev.com/5eb1019b22b646ee388bbecec17d5af17c3bb339/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java [modify] https://crrev.com/5eb1019b22b646ee388bbecec17d5af17c3bb339/content/test/data/android/input/input_forms.html
,
Nov 10 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/af689b896e2307286cc6b82b2728fe16b483f897 commit af689b896e2307286cc6b82b2728fe16b483f897 Author: Alexandre Elias <aelias@chromium.org> Date: Thu Nov 10 06:39:58 2016 Make WebView keep keyboard when losing focus (2nd cherrypick) WebView should not hide keyboard when losing focus. As for Chrome, it should keep current behavior. These cases include when the ContentView is hidden (closing current tab, opening a new tab, switching to an existing tab), and when imeAdapter is attached to its native counterpart(navigation). Note that this CL will change one behavior of Chrome: keyboard will not be hidden when focus moves from ContentView to UrlBar. BUG= 636237 Review URL: https://codereview.chromium.org/2492763002 . Review-Url: https://codereview.chromium.org/2290133002 Cr-Original-Commit-Position: refs/heads/master@{#429531} Cr-Commit-Position: refs/branch-heads/2883@{#517} Cr-Branched-From: 614d31daee2f61b0180df403a8ad43f20b9f6dd7-refs/heads/master@{#423768} [modify] https://crrev.com/af689b896e2307286cc6b82b2728fe16b483f897/content/public/android/BUILD.gn [modify] https://crrev.com/af689b896e2307286cc6b82b2728fe16b483f897/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java [delete] https://crrev.com/6e2d4b414c441a235ba94d08cbbca7ff2d6b9d2c/content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreFocusTest.java
,
Nov 11 2016
verified with Galaxy S7 Verizon / MMB29M vs latest M56
,
Nov 11 2016
,
Nov 16 2016
Verified on Samsung Galaxy S6 Edge(SM-G925T)/MMB29K, Webview: 55.0.2883.53 |
|||||||||
►
Sign in to add a comment |
|||||||||
Comment 1 by changwan@chromium.org
, Aug 17 2016Owner: yabinh@chromium.org