diff options
| author | Benjamin Vray <bvr@odoo.com> | 2020-09-25 08:02:11 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-09-25 11:21:44 +0000 |
| commit | e6d32bc4bfa7f0c3c2f82c2eb99a562c1cb93d83 (patch) | |
| tree | a36d9b03befa3772e0ffe2ef607e7d6e449c91a8 /addons/web/static | |
| parent | b497837522779def181c19957e25c7629a567793 (diff) | |
[FIX] web, web_editor: fix scroll to hidden dropped snippets
Fix the scroll when the snippet is the dynamic one because it did not
work as we tried to get the offset of an element with the d-none class.
Remove the scrollValue variable because we don't need it anymore.
It was used before the code was reviewed in a previous commit.
task-2312878
closes odoo/odoo#58486
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web/static')
| -rw-r--r-- | addons/web/static/src/js/core/dom.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/addons/web/static/src/js/core/dom.js b/addons/web/static/src/js/core/dom.js index e0b0f67ef6d..4af811d41bc 100644 --- a/addons/web/static/src/js/core/dom.js +++ b/addons/web/static/src/js/core/dom.js @@ -518,7 +518,13 @@ var dom = { const isTopScroll = $scrollable.is($topLevelScrollable); function _computeScrollTop() { - const elPosition = $scrollable[0].scrollTop + ($el.offset().top - $scrollable.offset().top); + let offsetTop = $el.offset().top; + if (el.classList.contains('d-none')) { + el.classList.remove('d-none'); + offsetTop = $el.offset().top; + el.classList.add('d-none'); + } + const elPosition = $scrollable[0].scrollTop + (offsetTop - $scrollable.offset().top); let offset = options.forcedOffset; if (offset === undefined) { offset = (isTopScroll ? dom.scrollFixedOffset() : 0) + (options.extraOffset || 0); |
