360 the problem that a browser text box is masked by a soft keyboard after getting focus

Source: Internet
Author: User

The scene is this, the site filter button click after the popup layer (fixed), when the input box to get the focus after the system comes out of the soft keyboard, on Android 10 browser to test the comparison, found in 360 browser pop-up keyboard after the focus of the text box was covered by the soft keyboard. As follows

(case where soft keyboard focus is not acquired) (Chrome browser is adjusting the soft keyboard) (360 browser to adjust the soft keyboard)

So the question is, what kind of situation does the browser's soft keyboard show? English Chinese (online search)

After a simple understanding, probably analyzed the soft keyboard pop-up on the browser should include a soft keyboard to occupy the main activity space, so that the main activity re-layout and not adjust the size of the window floating in the above two ways (haha this is my yy)

360 should be using the latter, others may be using the former.

Since the problem arises, it is necessary to find a way to solve, so after a simple scrutiny, basically can be obtained ( there is no space to occupy the main window of the soft keyboard technology ) 1, when input to get the focus, 2, the soft keyboard will pop up, 3, the fixed layer needs to move up, 4, the successful input ; 5, when input blur or keyboard hit enter, fixed restore position (here to be thankful that 360 does not have the default with rotation screen following the rotation, or else a little trouble)

Now that the analysis is complete, write the code.

1. Add Recognition Browser code

1 varisSpecialBrowser = navigator.userAgent.match(/360 Aphone.*\(([\d.]+)\)$/i)//360等部分软键盘采用的是软键盘不占用主窗口空间造成,吸底的 input获取焦点的时候被遮罩

2. Handling Events

123456789101112131415161718 $(document)    .on(‘keydown keyup‘, Element,function(ev) {            if(code == 13 && isSpecialBrowser) {                    DOM.css(‘bottom‘, -310);                }            }                   })        .on(‘focus‘, Element,function() {            if(isSpecialBrowser) {               DOM.css(‘bottom‘, -110);            }        })        .on(‘blur‘, Element,function() {            if(isSpecialBrowser) {                DOM.css(‘bottom‘, -310);            }        });

  

Okay, the problem is solved.

But the problem is that the active click on the keyboard to close the button is not able to get any keycode and corresponding events, so there will be a problem.

360 the problem that a browser text box is masked by a soft keyboard after getting focus

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.