Apple mobile focus has no effect keyboard can't jump out

Source: Internet
Author: User


reason:

in IOS, Safari are now apparently remembering that element was focussed and not actually focussing it until a touch Down event.
It's then blindly sending a click event to whichever element received the touch up.
only events that are actively triggered by the user in iOS enable focus to take effect, so you can use the focus () method in events triggered by users before Focus

like the HTML in Vue:
<p id= "Click-ele" > Click to review </p>
<input id= "input" v-show= "Isinputshow" type= "text" ></input>

JS as follows:
document.getElementById (' Click-ele '). AddEventListener (' click ', Function () {
Vue.isinputshow = True
document.getElementById (' input '). Focus ()

},false)

after clicking on the comment, the input tag can focus and the keyboard will jump out.

Note that there are two points:
(1) Document.getelement to mounted that the DOM structure is rendered good after the use, otherwise not get the element.
(2) P label directly using the @click= "Handlerclick" event in Vue will not take effect, the reason is unknown, with the original event is not a problem.

Apple mobile focus has no effect keyboard can't jump out

Related Article

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.