Page MenuHomePhabricator

Android's Virtual Keyboard UI will be closed while trying typing on OOUI input inside a dialog
Closed, ResolvedPublic

Description

Steps to repro:

  1. Provide an Android device for yourself and use regular Chrome browser.
  2. Open
  3. Try to type something on the prompt input

Actual:
The virtual touch keyboard will be closed just immediately on opening the page.

Excepted:
Normal keyboard typing on the input, which is broken.

Users has repeatedly reported this issue so I went to check it on an Android device and now I see the same issue they are complaining about.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 4 2017, 10:14 AM
Ebraminio triaged this task as High priority.Apr 4 2017, 10:17 AM

I don't have an Android device handy – does the keyboard never appear at all? or can you bring it up by tapping the textfield again?

Ebraminio added a comment.EditedApr 4 2017, 8:56 PM

Keyboard just appears and then goes. Do you have Desktop Safari around? I probably have a similar case that just happens on Safari but I hope it indicates the same issue -- open OO.ui.alert($('<input><input>')) and try to enter text in the second input, you can't.

Ebraminio added a comment.EditedApr 4 2017, 9:02 PM

^ as the issue it seems is related to an unwanted unfocus on focusing inputs. If you don't have Desktop Safari, I hope you can reproduce above testcase using Webkit based Linux browsers like Epiphany.

My guess is it seems OOjs, on this mode (not happens with more integrated OOjs gadgets AFAICT), is firing focus on the first input again with some JS code when onfocus on the input actually happens.

Can reproduce that on Chrome 57/Android 7. Keyboard appears and disappears immediately after again, cause input field looses focus. Behaviour in Firefox/Android is a bit different, but similarly dissatisfying. Input field focusses just once and isn't able to be refocussed again.

Prtksxna added a comment.EditedJun 26 2017, 6:43 AM

Apparently, on Android, on both Chrome and Firefox, when a layout change is made on the resize event of the window the input loses focus (StackOverflow). So when the focus is set, the keyboard appears, triggering the resize event and making the input lose focus, and the keyboard disappears.

If we remove the resize handler the problem goes away, but will obviously introduce many others.

diff --git a/src/WindowManager.js b/src/WindowManager.js
index 19453185..e508a321 100644
--- a/src/WindowManager.js
+++ b/src/WindowManager.js
@@ -708,7 +708,7 @@ OO.ui.WindowManager.prototype.toggleGlobalEvents = function ( on ) {
         if ( !this.globalEvents ) {
             $( this.getElementWindow() ).on( {
                 // Start listening for top-level window dimension changes
-                'orientationchange resize': this.onWindowResizeHandler
+//              'orientationchange resize': this.onWindowResizeHandler
             } );
             if ( stackDepth === 0 ) {
                 scrollWidth = window.innerWidth - document.documentElement.clientWidth;

If I understand this correctly, no amount of setTimeouts will resolve this chain reaction. We'll just have to not run the resize handlers if an input is in focus?

Esanders renamed this task from Android Chrome's Virtual Keyboard UI will be closed while trying typing on OOjs UI input to Android Chrome's Virtual Keyboard UI will be closed while trying typing on OOjs UI input inside a dialog.Jul 26 2017, 11:54 AM

@Prtksxna Would you take this on?

Volker_E renamed this task from Android Chrome's Virtual Keyboard UI will be closed while trying typing on OOjs UI input inside a dialog to Android's Virtual Keyboard UI will be closed while trying typing on OOjs UI input inside a dialog.Oct 28 2017, 3:04 AM

Removing Accessibility – issue makes interface on some views completely unusable.

Volker_E renamed this task from Android's Virtual Keyboard UI will be closed while trying typing on OOjs UI input inside a dialog to Android's Virtual Keyboard UI will be closed while trying typing on OOUI input inside a dialog.Jan 8 2018, 10:05 PM
Prtksxna updated the task description. (Show Details)Apr 10 2018, 4:31 AM

Change 425456 had a related patch set uploaded (by Prtksxna; owner: Prtksxna):
[oojs/ui@master] WindowManager: Return focus to element after resize

https://gerrit.wikimedia.org/r/425456

Change 425456 merged by jenkins-bot:
[oojs/ui@master] WindowManager: Return focus to element after resize

https://gerrit.wikimedia.org/r/425456

Volker_E closed this task as Resolved.Apr 13 2018, 10:25 PM
Volker_E assigned this task to Prtksxna.
Volker_E moved this task from Backlog to OOUI-0.26.4 on the OOUI board.
Volker_E edited projects, added OOUI (OOUI-0.26.4); removed OOUI.
Volker_E removed a project: Patch-For-Review.

Thank you guys!

I confirm the fix but I see another issue which is not a regression but that was my original problem, T193348