N
N
Ninja Mate2016-09-13 15:01:25
css
Ninja Mate, 2016-09-13 15:01:25

How do I stop the keyboard from popping up when I click on an item on my iPad?

There is a ReactJS application in which, when a date is selected, the calendar pops up, but the keyboard opens.
How and how to prevent the keyboard from appearing on tablets?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Ninja Mate, 2016-09-13
@victorzadorozhnyy

onClick or onFocus put this function

"use strict";
const HideKeyboard=()=> {
    //this set timeout
    setTimeout(function() {
        var field = document.createElement('input');
        field.setAttribute('type', 'text');
        field.setAttribute('style', 'position:absolute; top: 0px; -webkit-transform: translateY(-9999px); -webkit-user-modify: read-write-plaintext-only; left:0px;');
        document.body.appendChild(field);

        field.onfocus = function(){
            setTimeout(function() {
                field.setAttribute('style', 'display:none;');
                setTimeout(function() {
                    document.body.removeChild(field);
                    document.body.focus();
                }, 14);
            }, 200);
        };
        field.focus();
    }, 50);
};

export default HideKeyboard;

A
Artem, 2016-09-13
@proudmore

Not an expert, but maybe the browser is processing some kind of event that you need to climb into?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question