Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

Keyboard hiding even with event.preventdefault

$
0
0

I have a chat application and I would like the user to click a send button on the UI and the keyboard stay open. Normally the keyboard closes, I am guessing because the input element loses focus when the button is click. At the moment the keyboard comes straight back because of the timeout code, however this is noticeable from the user and I would prefer the keyboard to stay.

This is on iOS, seen in multiple versions 8 and 9. I'm using ionic version 1.0.0 and com.ionic.keyboard version 1.0.4

Does anyone know how to keep the keyboard open during this bit of javascript? Only the first and second line actually need to run.

$scope.sendChat = function($event) {
      backend.addMessage($scope.data.chatInput);
      $scope.data.chatInput = '';
      $event.preventDefault();
      $event.stopPropagation();
      $timeout(function() {
        if ($scope.inputEl) {
          $scope.inputEl.focus();
        }
      }, 0);
};

Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>