From 25165792c87ade45f27a8a4c5e47a475cd28e1e8 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 24 Sep 2019 09:29:57 +0200 Subject: [PATCH] #1680 left-menu descriptor scrollbar overlap --- front/core/components/popover/popover.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/front/core/components/popover/popover.js b/front/core/components/popover/popover.js index c999514cd..38f566135 100644 --- a/front/core/components/popover/popover.js +++ b/front/core/components/popover/popover.js @@ -75,9 +75,19 @@ export default class Popover extends Component { if (parent) this.parent = parent; let isDescriptorMoreMenu = parent && parent.attributes[0].nodeValue == 'more-button'; - const leftMenu = this.document.querySelector('div[class="menu left"]'); + let leftMenu = this.document.querySelector('div[class="menu left"]'); if (isDescriptorMoreMenu && leftMenu) { + let leftMenuWidth = leftMenu.offsetWidth; + let descriptorDiv = this.document.querySelector('vn-side-menu div'); + + let descriptorWidth = descriptorDiv.offsetWidth; + this.scrollbarWidth = leftMenuWidth - descriptorWidth; + let newWidth = leftMenuWidth - this.scrollbarWidth; + leftMenu.style.overflow = 'hidden'; + leftMenu.style.minWidth = `${newWidth}px`; + leftMenu.style.width = `${newWidth}px`; + this.restoreOverflow = true; } @@ -106,7 +116,12 @@ export default class Popover extends Component { if (this.restoreOverflow) { const leftMenu = this.document.querySelector('div[class="menu left"]'); + let leftMenuWidth = parseInt(leftMenu.style.width); + let newWidth = leftMenuWidth + this.scrollbarWidth; leftMenu.style.overflow = 'auto'; + leftMenu.style.minWidth = `${newWidth}px`; + leftMenu.style.width = `${newWidth}px`; + this.restoreOverflow = false; } this._shown = false;