[MERGE] forward port of branch 8.0 up to e883193
[odoo/odoo.git] / addons / im_chat / static / src / js / im_chat.js
index 79f5691..9962fdf 100644 (file)
             this._go_bottom();
         },
         keydown: function(e) {
+            if(e && e.which == 27) {
+                if(this.$el.prev().find('.oe_im_chatview_input').length > 0){
+                    this.$el.prev().find('.oe_im_chatview_input').focus();
+                }else{
+                    this.$el.next().find('.oe_im_chatview_input').focus();
+                }
+                e.stopPropagation();
+                this.update_fold_state('closed');
+            }
             if(e && e.which !== 13) {
                 return;
             }
             this.calc_box();
             var fct =  _.bind(function(place) {
                 this.set("right_offset", place + this.$el.outerWidth());
+                this.$(".oe_im_searchbox").focus();
             }, this);
             var opt = {
                 step: fct,