Skip to content
Snippets Groups Projects
Commit 3d575e63 authored by Benjamin Vray's avatar Benjamin Vray
Browse files

[FIX] web: fix scrollbar width compensation when a modal is open


Before this commit, when we calculated the width of the scrollbar
to compensate when a modal is open. We did not take into account the
wrapwrap borders applied with some headers. (e.g. the sidebar header)

task-2677132

closes odoo/odoo#78926

Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
parent 8c5ee0d1
No related branches found
No related tags found
No related merge requests found
......@@ -153,7 +153,10 @@ $.fn.extend({
}
const scrollableEl = isScrollElement ? el : $(el).parent().closestScrollable()[0];
const style = window.getComputedStyle(el);
const newValue = parseInt(style[cssProperty]) + scrollableEl.offsetWidth - scrollableEl.clientWidth;
const borderLeftWidth = parseInt(style.borderLeftWidth.replace('px', ''));
const borderRightWidth = parseInt(style.borderRightWidth.replace('px', ''));
const bordersWidth = borderLeftWidth + borderRightWidth;
const newValue = parseInt(style[cssProperty]) + scrollableEl.offsetWidth - scrollableEl.clientWidth - bordersWidth;
el.style.setProperty(cssProperty, `${newValue}px`, 'important');
}
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment