Ionic keyboard closes when google suggestions are used?


#1

Hi,

I am new to Ionic and this community. This is my first message here.

I am trying to create a chat module in my app like Google Hangouts. I have created an input type="text" field and a submit button.

The code I have written for that is:

    <form name="sendMessageForm" ng-submit="sendMessage($event)" novalidate>
        <ion-footer-bar keyboard-attach class="bar-stable item-input-inset" id="chat-footer-bar">
            <label class="item-input-wrapper">
                <input chatinput type="text" id="chatInputField" placeholder="Type your message..." ng-model="data.message" focus-on-blur="focusManager.focusInputOnBlur"/>
            </label>
            <button class="button button-clear ion-paper-airplane" ng-click="sendMessage($event)"></button>
        </ion-footer-bar>
    </form>

now everytime I have to send a message I click on the submit button and sendMessage($event) method is called. Since I would like to keep my keyboard opened while i am sending messages like any other messaging app i have written a code in the sendMessage($event) method to maintain focus on the input field.

The code for that is:

$scope.sendMessage = function($event){
var ele = document.getElementById("chatInputField"); 
        if (ele) {
            $timeout(function() {
                ele.focus();
            });
        }
};

Now this logic is working fine and the keyboard remains open as long as I am typing the alphabets (a-z) and numbers(0-9) in the keyboard but when i use google suggestions which come in the keyboard or any other special character like (_, *, # etc) from the keyboard my keyboard show unusual behaviour, it first closes then reopen and then again closes.

Please help guys.