diff options
| author | qsm-odoo <qsm@odoo.com> | 2017-09-18 16:20:19 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2017-09-20 15:03:56 +0200 |
| commit | 26e079f246c196bc08669db3894c8b2c83cc2639 (patch) | |
| tree | 3412dd60ee078bf885ba08c602f06f83c9f99d98 /addons/mail/static/src | |
| parent | 85a0399d4f31b6edcdf6541d4b6a37220a5e0771 (diff) | |
[FIX] mail: make clicking on chat window's emoji button properly work
Before this commit, clicking on the button opened the emoji popover
then closed it immediately. This was because of a handler which said
that clicking on any part of the composer should focus the input
element. This is indeed required when the UI is blocked (thanks to
the `blockUI` function). Solution is to not force this focus when
clicking on any composer's button element.
To prevent breaking those two behaviors (blockUI focus and emoji), two
tests were implemented.
Diffstat (limited to 'addons/mail/static/src')
| -rw-r--r-- | addons/mail/static/src/js/chat_window.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/addons/mail/static/src/js/chat_window.js b/addons/mail/static/src/js/chat_window.js index d65660ef90c..95988d27424 100644 --- a/addons/mail/static/src/js/chat_window.js +++ b/addons/mail/static/src/js/chat_window.js @@ -19,7 +19,7 @@ return Widget.extend({ escape_pressed: '_onEscapePressed' }, events: { - "click .o_chat_composer": "focus_input", // focus even if jquery's blockUI is enabled + 'click .o_chat_composer': '_onComposerClick', "click .o_mail_thread": "_onChatWindowClicked", "keydown .o_chat_composer": "on_keydown", "keypress .o_chat_composer": "on_keypress", @@ -103,9 +103,10 @@ return Widget.extend({ this.fold(); }, focus_input: function () { - if (!config.device.touch) { - this.$input.focus(); + if (config.device.touch && config.device.size_class <= config.device.SIZES.SM) { + return; } + this.$input.focus(); }, do_show: function () { this.is_hidden = false; @@ -167,6 +168,19 @@ return Widget.extend({ } }, /** + * Called when the composer is clicked -> forces focus on input even if + * jquery's blockUI is enabled. + * + * @private + * @param {Event} ev + */ + _onComposerClick: function (ev) { + if ($(ev.target).closest('a, button').length) { + return; + } + this.focus_input(); + }, + /** * @private */ _onEscapePressed: function () { |
