details: https://code.tryton.org/tryton/commit/251611736c80
branch: default
user: Nicolas Évrard <[email protected]>
date: Wed Aug 19 19:21:05 2026 +0200
description:
Add horizontal scrolling to scrollIntoViewIfNeeded
Closes #15025
diffstat:
sao/src/common.js | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diffs (29 lines):
diff -r dc3a3e200063 -r 251611736c80 sao/src/common.js
--- a/sao/src/common.js Fri Aug 14 12:55:53 2026 +0200
+++ b/sao/src/common.js Wed Aug 19 19:21:05 2026 +0200
@@ -112,16 +112,25 @@
let container_rect = container.getBoundingClientRect();
let top_ = rect.top - container_rect.top;
let bottom = top_ + rect.height;
+ let left = rect.left - container_rect.left;
+ let right = left + rect.width;
let target_top = container.scrollTop;
+ let target_left = container.scrollLeft;
if (top_ < 0) {
target_top += top_ - container.clientHeight / 2;
} else if (bottom > container.clientHeight) {
target_top += bottom - container.clientHeight / 2
}
+ if (left < 0) {
+ target_left += left - container.clientWidth / 2;
+ } else if (right > container.clientWidth) {
+ target_left += right - container.clientWidth / 2;
+ }
container.scrollTo({
top: Math.max(0, target_top),
+ left: Math.max(0, target_left),
});
}
}