iphone keyboard not hiding when tapping the screen

后端 未结 7 1072
小鲜肉
小鲜肉 2021-02-07 00:06

I have an input field with number type


In normal browsers, I\'m typing some numbers and I\'m

相关标签:
7条回答
  • 2021-02-07 00:35

    In an ionic application I used a directive on the body that intercepts the inputs.

    MyApp.directive('dismissIosKeyboardOnClick', function () {
            return function (scope, element, attrs) {
              if (cordova.platformId=="ios") {
                element.on("touchstart", function(e) {
                  var keyboardDoms = new Set(["INPUT","TEXTAREA","SELECT"]);
                  if( keyboardDoms.has(document.activeElement.nodeName) &&
                      !keyboardDoms.has(e.target.nodeName) )
                    document.activeElement.blur();
                  });
                }
            };
          });
    

    Index.html

    <body ... dismiss-ios-keyboard-on-click></body>
    
    0 讨论(0)
提交回复
热议问题