[FIXED] keep keyboard open on Ionic when button click ( chat app )

Issue

I have an Ionic v1 chat application, I made everything, but I encountred the famous problem when clicking on a send button (send chat) the keyboard loses focus from the input and then closes.

I’ve tried many approaches, but it none of them work:

  • Input directive to keep focus,
  • forcing focus on click event,
  • modifying the value of InputUserAction in config.xml to false.

Any help is much appreciated.

<div class="sender">
<input type="text" ng-model="..." class="...">
<div class="button-send">
<span class="send-chat"><i class="ion ion-send"></i></span>
</div>
</div>

Solution

just use (mousedown)="sentMessage(); $event.preventDefault()"

<ion-button (mousedown)="sentMessage(); $event.preventDefault()">
      <ion-icon ios="ios-send" md="md-send"></ion-icon>
</ion-button>

Answered By – shanthan

Answer Checked By – Robin (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published