Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-14090

iOS:App based on cordova-plugin-inappbrowser which is running on the iPad and the soft keyboard can't be ejected by focus () under certain conditions



    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Do
    • cordova-ios@4.5.4, cordova@8.0.0
    • None


      We using the Angular5.2.9 + Ionic3.2 + Ionic Native 4.5.3 + Cordova8.0 + Cordova-ios 4.5.4 + Cordova-plugin-inappbrowser 2.0.3-dev  to make an app to access the following HTML in the app:

      The ScreenShot of the HTML


          <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
          <meta http-equiv="Pragma" content="no-cache">
          <meta http-equiv="Cache-Control" content="no-cache">
          <meta http-equiv="Expires" content="0">
          <script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
          <script language="javascript">
              var objInput1=null;
              var objInput2=null;
              function initLoad()
              function onBlur(event)
                  if(event.target.value == 'abc')
                      return true;
                  //If we do not use setTimeout to perform alert here,
                  //the InAppBrowser will die without responding to any action in the Pattern2
                  setTimeout(function () {
                      alert('Please input abc');
                  }, 0);
                  event.target.style.backgroundColor = "#ff0000";
                  return false;
      <body onload="javascript:initLoad()">
      input1:<input type="text" id="input1" onblur="javascript:onBlur(event);"/>&nbsp&nbsp&nbsp&nbsp - &nbsp&nbsp&nbsp&nbsp
      input2:<input type="text" id="input2"/>


      The above code is designed to achieve the following effects:

      Step1. When the focus in the input1, the ipad automatically display soft keyboard (It's should be iOS default function, focus on the input box will automatically eject the soft keyboard)
      The ScreenShot of Step1

      Step2. When we enter content in input1, it will show alert warning if it found that the input is not "abc" when the input1 lose focus (implemented in the onblur event)
      The ScreenShot of Step2

      Step3. At the same time , the background color of the input1 will be changed to red, and let the focus return to the input1 and automatically display the soft keyboard again
      The ScreenShot of Step3

      Our problem is, at the Step2, we can make input1 lose focus in two ways(The Pattern1 and The Pattern2):

      Pattern1. Use mouse to click input2

      Pattern2. Press the button in the lower right corner of the soft keyboard to put the keyboard away
      The ScreenShot of the button

      At present, when we operate by Pattern1, there is no problem, the Step3 can be expected to show the effect.

      But when we operate by Pattern2, when by calling the focus() method to make input1 get the focus, soft keyboard will flash (appear, and immediately disappear), tried a lot of ways to keep the soft keyboard always appear, we already took 2, 3 days to try to solve the problem, are not done. Do not know whether need to modify InAppBrowser's Objective-C code? Please tell us how to solve the problem. Thank you very much.





            Unassigned Unassigned
            fcmpww Xiao He
            0 Vote for this issue
            2 Start watching this issue