# Chat input bar with Ionic

**URL:** <https://forum.ionicframework.com/t/chat-input-bar-with-ionic/21167>\
**Category:** ionic-v1\
**Created:** [April 17, 2015, 10:06am UTC](https://forum.ionicframework.com/t/chat-input-bar-with-ionic/21167 "2015-04-17T10:06:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![xavierheysch](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/xavierheysch/32/92184_2.png) [@xavierheysch](https://forum.ionicframework.com/u/xavierheysch)\
**Post date:** [April 17, 2015, 10:06am UTC](https://forum.ionicframework.com/t/chat-input-bar-with-ionic/21167/1 "2015-04-17T10:06:56Z")

</div>

Hi everyone,

I’m trying to make a chat view in Ionic (v1.0.0-rc.2) but I have issues regarding the input chat bar.  
I’m using a ion-footer-bar with keyboard-attach directive. This footer contains a textarea and a sending button.  
I have tried many things but the result is not smooth / not native at all.

As you can see in the following issue I have submited ([https://github.com/driftyco/ionic/issues/3537](https://github.com/driftyco/ionic/issues/3537)), there is an animation problem but here is another issue.

When I click on the textarea, the keyboard is opening correctly. Then I enter some characters in it and when I click on the “send” button, the keyboard is disappearing.

As WhatsApp, Line, iMessages, etc., I want the keyboard to stay open and prevent it to be closed automatically.

If anybody have found a solution regarding that, I’m looking for help! 😉

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [April 17, 2015, 1:13pm UTC](https://forum.ionicframework.com/t/chat-input-bar-with-ionic/21167/2 "2015-04-17T13:13:12Z")

</div>

So this can be done using a form element.

> <https://github.com/mhartington/ionic-firebase/blob/master/www/templates/chat.html#L32>

---

<div class="post-metadata">

**Author:** ![xavierheysch](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/xavierheysch/32/92184_2.png) [@xavierheysch](https://forum.ionicframework.com/u/xavierheysch)\
**Post date:** [April 17, 2015, 1:32pm UTC](https://forum.ionicframework.com/t/chat-input-bar-with-ionic/21167/3 "2015-04-17T13:32:43Z")

</div>

I want to post the message with a send button like all messaging app.

The using of the “return” button of keyboard to submit the form is not wanted here. This “return” button is used to make a jump line.

Is there a way with the current version of Ionic ?

---

<div class="post-metadata">

**Author:** ![AndySoHotRightNow](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@AndySoHotRightNow](https://forum.ionicframework.com/u/AndySoHotRightNow)\
**Post date:** [October 8, 2015, 10:09am UTC](https://forum.ionicframework.com/t/chat-input-bar-with-ionic/21167/4 "2015-10-08T10:09:39Z")

</div>

Xavier made a good observation about the keyboard animation. It is not smooth or native at all.

Both the ‘keyboard-attach’ directive and the ‘ion-footer-bar’ work well together in static positions. However during keyboard animations, it looks as though the keyboard and the input field travel at two different speeds (keyboard springs up slower than the input field, revealing empty background on the way up, and disappears equally slower than the input field on the way back, partially covering it while disappearing/losing focus).

I am also trying to make a Chat app and would be incredibly eager to know if anybody has found a work-around (CSS? Angular? jQuery?).

EDIT: to answer Xavier’s question on how to get the keyboard to stay open after pressing the ‘send’ button, I made this directive:

```
 .directive("isFocused", function($timeout) {
    return {
        link: function(scope, element) {
              scope.$watch("isFocused", function (value) {
                $timeout(function () {
                    if (scope.isFocused) {
                          element[0].focus();
                      }
                      element.on("blur", function () {
                          if (scope.isFocused) {
                              element[0].focus();
                        }
                      });
                  });
              });
        }
    };
 });

```

and in my controller I have:

```
$scope.isFocused = true;
$scope.contentClick = function () { // triggered by an ngClick placed in <ion-content>
    $scope.isFocused = false;
}
$scope.inputClick = function () { // triggered by an ngClick placed in the <textarea>
    $scope.isFocused = true;
}
```

---

<div class="post-metadata">

**Author:** ![ktekosi](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@ktekosi](https://forum.ionicframework.com/u/ktekosi)\
**Post date:** [July 21, 2016, 2:42pm UTC](https://forum.ionicframework.com/t/chat-input-bar-with-ionic/21167/5 "2016-07-21T14:42:53Z")

</div>

Hi there,

Having the same problem with the keyboard hiding when pressing the send button, I’ve tried the fix stated in this topic, however, the keyboard does hide and then reappears, so there is a slide down - slide up animation that is annoying.  
I’ve located a blur event being called with **ele.blur();** on function **tapFocusOutActive** from the ionic.bundle.js file at line 3151. If I comment out that line, the blur event does not trigger anymore, the keyboard does not hide … but, a selection cursor appears like in the attached image that flickers between the top of the screen and the input.  
So far, I’ve tested on android 6 on a nexus 5 and 5X.  
The ionic framework version is v1.2.4-nightly-1917  
Can anyone help with this issue?

Thx,  
Victor

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/8/9/899f5571ebc5b43ad0e5b619ccac7d4db268b727.png)

---

<div class="post-metadata">

**Author:** ![ktekosi](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@ktekosi](https://forum.ionicframework.com/u/ktekosi)\
**Post date:** [August 3, 2016, 12:04pm UTC](https://forum.ionicframework.com/t/chat-input-bar-with-ionic/21167/6 "2016-08-03T12:04:47Z")

</div>

Hello, can anyone help with this issue?

---

<div class="post-metadata">

**Author:** ![traviss](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@traviss](https://forum.ionicframework.com/u/traviss)\
**Post date:** [September 11, 2016, 3:05pm UTC](https://forum.ionicframework.com/t/chat-input-bar-with-ionic/21167/7 "2016-09-11T15:05:37Z")

</div>

did you ever solve the animation issue?

---

<div class="post-metadata">

**Author:** ![xavierheysch](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/xavierheysch/32/92184_2.png) [@xavierheysch](https://forum.ionicframework.com/u/xavierheysch)\
**Post date:** [September 11, 2016, 7:53pm UTC](https://forum.ionicframework.com/t/chat-input-bar-with-ionic/21167/8 "2016-09-11T19:53:27Z")

</div>

No, i’m sorry…

Just the tweak mentionned in the post. But the result is not really what I wanted for an app with a chat…

I have not work on it since few months so maybe…

Have you try with Ionic 2 beta?

Envoyé de mon iPhone

---

<div class="post-metadata">

**Author:** ![jdnichollsc](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jdnichollsc/32/137196_2.png) [@jdnichollsc](https://forum.ionicframework.com/u/jdnichollsc)\
**Post date:** [September 21, 2016, 12:20am UTC](https://forum.ionicframework.com/t/chat-input-bar-with-ionic/21167/9 "2016-09-21T00:20:48Z")

</div>

Check my Ionic chat template! 😃 [http://market.ionic.io/plugins/ionic-elastichat-images](http://market.ionic.io/plugins/ionic-elastichat-images)
