Fix the bug of input method occlusion input box in Android mobile phone
· Logging · 2 comments · 4,209 Views

Fix the bug of input method occlusion input box in Android mobile phone

· Logging · 2 comments · 4,209 Views
 //. container sets the overflow property, which causes the input method to block the bug in the input box when the input box gets focus on the Android phone / / related issue: HTTPS: / / GitHub. COM / weui / weui / issues / 15 / / solution: 
 / / 0, However, this demo will cause other problems 
 / / 1. Refer to http://stackhoverflow.com/questions/23757345/android-does-not-properly-scroll-on-input-focus-if-not-body-element 
 / / when input or textarea elements are focused, roll 
 if (/ Android / GI. Test (navigator. Useragent)) {window. Addeventlistener ('reset ', function () {
        if (document.activeElement.tagName == 'INPUT' || document.activeElement.tagName == 'TEXTAREA') {
            window.setTimeout(function () {
                //document.activeElement.scrollIntoViewIfNeeded();
                document.activeElement.scrollIntoView();
            }, 0);
        }
    })
}

Just found the above code, if you use the commented out code is invalid, in the new weui/issues/577 Find a new method in:
take document.activeElement.scrollIntoViewIfNeeded Change to document.activeElement.scrollIntoView
This function can be implemented instead.

Add a new comment
  1. Ha ha ha, I haven't met it yet.

    reply
  2. Thanks for sharing

    reply