diff options
| author | Alexandre Kühn <aku@odoo.com> | 2020-12-04 12:54:12 +0000 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2020-12-04 16:12:06 +0000 |
| commit | af2b09b32363389666a94f382260b3128705a2e5 (patch) | |
| tree | 799370dc5305a1dccd4ebca5901e5da5b87e9878 /addons/mail | |
| parent | 334bf078a4bfd600e1be4b22fc2511ca58aa4e94 (diff) | |
[FIX] mail: prevent Safari from indefinitely focusing composer
`setSelectionRange()` on Safari has side-effect to focusing the
input element, which is not the case in Chrome and Firefox.
Task-2410311
closes odoo/odoo#62912
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail')
| -rw-r--r-- | addons/mail/static/src/components/composer_text_input/composer_text_input.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/addons/mail/static/src/components/composer_text_input/composer_text_input.js b/addons/mail/static/src/components/composer_text_input/composer_text_input.js index 7830667ce7c..1b71e22afe1 100644 --- a/addons/mail/static/src/components/composer_text_input/composer_text_input.js +++ b/addons/mail/static/src/components/composer_text_input/composer_text_input.js @@ -155,11 +155,13 @@ class ComposerTextInput extends Component { } this._textareaRef.el.value = this.composer.textInputContent; this._mirroredTextareaRef.el.value = this.composer.textInputContent; - this._textareaRef.el.setSelectionRange( - this.composer.textInputCursorStart, - this.composer.textInputCursorEnd, - this.composer.textInputSelectionDirection, - ); + if (this.composer.hasFocus) { + this._textareaRef.el.setSelectionRange( + this.composer.textInputCursorStart, + this.composer.textInputCursorEnd, + this.composer.textInputSelectionDirection, + ); + } this._updateHeight(); } |
