#1680 left-menu descriptor scrollbar overlap

This commit is contained in:
Carlos Jimenez Ruiz 2019-09-24 09:29:57 +02:00
parent a091674f08
commit 25165792c8
1 changed files with 16 additions and 1 deletions

View File

@ -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;