summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_renderer.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-09-29 08:50:28 +0200
committerAaron Bohy <aab@odoo.com>2017-09-29 16:02:36 +0200
commit36b4d78a2678806b25aaa5650b64496f9da9d205 (patch)
treee5325edb2d1a26530f587325e249d2b76136951a /addons/web/static/src/js/views/basic/basic_renderer.js
parentf9dc8cf76dc8cd9bd091c7e0c4bdf368a9e47b23 (diff)
[FIX] web,mail: reset focus after onchange on x2many
Rev. 2728fe1 introduced an attempt of restoring the focus on the currently focused field in an x2many list after an onchange returned, and the list has been updated. However, it was often wrong (e.g. leaving a field by pressing tab/shift+tab, clicking on another field...) and reset the focus on an unexpected field. In addition to fixing this issue, this rev. also unifies the helper functions to get and set the cursor positions in an input or textarea, as they were duplicated between mail and web.
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_renderer.js')
-rw-r--r--addons/web/static/src/js/views/basic/basic_renderer.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_renderer.js b/addons/web/static/src/js/views/basic/basic_renderer.js
index 24922622a42..93dd1f4fb73 100644
--- a/addons/web/static/src/js/views/basic/basic_renderer.js
+++ b/addons/web/static/src/js/views/basic/basic_renderer.js
@@ -127,7 +127,7 @@ var BasicRenderer = AbstractRenderer.extend({
this.editRecord(id);
if (typeof offset === "number") {
var field = _.findWhere(this.allFieldWidgets[id], {name: fieldName});
- dom.setCursor(field.getFocusableElement(), offset);
+ dom.setSelectionRange(field.getFocusableElement().get(0), {start: offset, end: offset});
}
},