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

[FIX] web: fix the scrollbar compensation for rtl pages

In Website, since the `#wrapwrap` element is being scrolled on the
pages, we added a function called `compensateScrollbar` (added by this
commit [1]) that adds space on the right side equal to the width of the
scrollbar when a modal is open or to adjust the position of the fixed
header when a page is scrolled.

However, this `compensateScrollbar` function did not handle RTL pages
correctly, where the scrollbar is on the left instead of the right. As a
result, on RTL language pages, this space was added on the wrong side.

This commit fixes the issue by placing the space on the left instead on
RTL pages.

Steps to reproduce the bug:
- Select Arabic as the primary language for a website.
- In edit mode, drag and drop a popup onto a page.
- Bug: When the popup is open, space is added on the right to compensate
for the scrollbar, but it should be on the left instead.

[1]: https://github.com/odoo/odoo/commit/ebd0c90a146145079061e79c2d4c37fa182a2975



task-3102275

closes odoo/odoo#126663

X-original-commit: 9e126f7f
Signed-off-by: default avatarBenoit Socias (bso) <bso@odoo.com>
parent 01fd29d5
No related branches found
No related tags found
No related merge requests found
......@@ -159,11 +159,15 @@ $.fn.extend({
compensateScrollbar(add = true, isScrollElement = true, cssProperty = 'padding-right') {
for (const el of this) {
// Compensate scrollbar
const scrollableEl = isScrollElement ? el : $(el).parent().closestScrollable()[0];
const isRTL = scrollableEl.matches(".o_rtl");
if (isRTL) {
cssProperty = cssProperty.replace("right", "left");
}
el.style.removeProperty(cssProperty);
if (!add) {
return;
}
const scrollableEl = isScrollElement ? el : $(el).parent().closestScrollable()[0];
const style = window.getComputedStyle(el);
const borderLeftWidth = parseInt(style.borderLeftWidth.replace('px', ''));
const borderRightWidth = parseInt(style.borderRightWidth.replace('px', ''));
......
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