From 91ad255e07d3d16f2ea88ca5b49bbe569ea5e2b4 Mon Sep 17 00:00:00 2001 From: GeoSot Date: Fri, 8 Oct 2021 12:14:45 +0300 Subject: [PATCH] Change adjustDialog's if conditions to improve readability --- js/src/modal.js | 10 ++++++---- 1 file 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` } }