You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Xiao He (JIRA)" <ji...@apache.org> on 2018/05/18 01:40:00 UTC

[jira] [Commented] (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

    [ https://issues.apache.org/jira/browse/CB-14090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16479991#comment-16479991 ] 

Xiao He commented on CB-14090:
------------------------------

Is there any way to control the soft keyboard show or hide by code ?

> 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
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CB-14090
>                 URL: https://issues.apache.org/jira/browse/CB-14090
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-ios, cordova-plugin-inappbrowser
>    Affects Versions: cordova-ios@4.5.4, cordova@8.0.0
>         Environment: Angular v5.2.9
> Ionic v3.2
> Ionic Native v4.5.3
> Ionic Angular v3.9.2
> Cordova v8.0.0
> Cordova-ios v4.5.4
> Cordova-plugin-inappbrowser v2.0.3-dev
> cordova-plugin-ionic-keyboard v2.0.5
> macOS High Sierra v10.13.3
> Xcode v9.3(9E145)
> npm v5.6.0
> Node.js v8.11.1
>  
>            Reporter: Xiao He
>            Assignee: Suraj Pindoria
>            Priority: Major
>              Labels: InAppBrowser, Softkeyboard, blur, flash, focus, iOS
>
> 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 |https://i.stack.imgur.com/n89gP.png]
> testsoftkeyboard3.html: 
> {code:java}
> <html>
> <head>
>     <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()
>         {
>             objInput1=document.getElementById("input1");
>             objInput2=document.getElementById("input2");
>         }
>         function onBlur(event)
>         {
>             if(event.target.value == 'abc')
>             {
>                 event.target.style.backgroundColor="#ffffff";
>                 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');
>                 //objInput1.focus();
>                 //objInput1.click();
>             }, 0);
>             event.target.style.backgroundColor = "#ff0000";
>             event.target.focus();
>             event.target.click();
>             return false;
>         }
>     </script>
> </head>
> <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"/>
> <br/>
> </body>
> </html>
> {code}
>  
> 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|https://i.stack.imgur.com/kC96b.png]
> 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|https://i.stack.imgur.com/uEuSi.png]
> 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|https://i.stack.imgur.com/tHqNb.png]
> 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|https://i.stack.imgur.com/NY1AN.png]
> 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.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org