From cf1a8f34b11fd7d7c657e68cf02a262e3f7a7698 Mon Sep 17 00:00:00 2001 From: "Guillaume (gdi)" Date: Thu, 17 Feb 2022 16:07:46 +0000 Subject: [PATCH] [IMP] web_editor: scroll to new element of we-list This commit improves the ListUserValueWidget to scoll to the new element when the user adds a new element. task-2601533 closes odoo/odoo#81241 Signed-off-by: Vray Benjamin (bvr) --- addons/web_editor/static/src/js/editor/snippets.options.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index 15c49a68e56..68acfdba9b4 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -2249,6 +2249,9 @@ const ListUserValueWidget = UserValueWidget.extend({ } this._addItemToTable(undefined, this.el.dataset.defaultValue, recordData); this._notifyCurrentState(); + // Scroll to the new list element. + this.el.querySelector('tr:last-child') + .scrollIntoView({behavior: 'smooth', block: 'nearest'}); }, /** * @private