[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#62886

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Alexandre Kühn
2020-12-04 12:54:14 +00:00
parent 20fc0e4d27
commit 4efb465f6a
@@ -165,11 +165,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();
}