diff options
author | GeoSot <geo.sotis@gmail.com> | 2021-10-08 12:14:45 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2021-11-25 20:23:49 +0300 |
commit | 91ad255e07d3d16f2ea88ca5b49bbe569ea5e2b4 (patch) | |
tree | fa960ab526b40d8ea7d8d0870bb2ed4696743258 | |
parent | 569bca54d2552b4a1ab39d15f5e4e6108b17d38e (diff) |
Change adjustDialog's if conditions to improve readability
-rw-r--r-- | js/src/modal.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/js/src/modal.js b/js/src/modal.js index ecbf5cadca..b8b1447746 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -326,12 +326,14 @@ class Modal extends BaseComponent { const scrollbarWidth = this._scrollBar.getWidth() const isBodyOverflowing = scrollbarWidth > 0 - if ((!isBodyOverflowing && isModalOverflowing && !isRTL()) || (isBodyOverflowing && !isModalOverflowing && isRTL())) { - this._element.style.paddingLeft = `${scrollbarWidth}px` + if (isBodyOverflowing && !isModalOverflowing) { + const property = isRTL() ? 'paddingLeft' : 'paddingRight' + this._element.style[property] = `${scrollbarWidth}px` } - if ((isBodyOverflowing && !isModalOverflowing && !isRTL()) || (!isBodyOverflowing && isModalOverflowing && isRTL())) { - this._element.style.paddingRight = `${scrollbarWidth}px` + if (!isBodyOverflowing && isModalOverflowing) { + const property = isRTL() ? 'paddingRight' : 'paddingLeft' + this._element.style[property] = `${scrollbarWidth}px` } } |