Web: Components: Fix dropdown offset

This commit is contained in:
Aleksandr Lushkin 2023-07-10 12:14:38 +02:00
parent 50097b252a
commit 89605c9844

View File

@ -233,12 +233,13 @@ class DropDown extends React.PureComponent {
if (this.props.right) {
dropDown.style.left = this.props.right;
} else if (this.props.directionX === "right") {
dropDown.style.left = parentRects.left + "px";
dropDown.style.left = parentRects.left - scrollBarWidth + "px";
} else if (parentRects.right - dropDownRects.width < 0) {
if (parentRects.left + dropDownRects.width > viewport.width) {
dropDown.style.left = viewport.width - dropDown.clientWidth + "px";
dropDown.style.left =
viewport.width - dropDown.clientWidth - scrollBarWidth + "px";
} else {
dropDown.style.left = parentRects.left + "px";
dropDown.style.left = parentRects.left - scrollBarWidth + "px";
}
} else {
dropDown.style.left =