From 769cf1c9870b3ebcb75e5a96e30fbc141efb1792 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 14 Apr 2020 17:34:39 +0100 Subject: [PATCH] Allow network dropdown to be scrollable and fix context menu window padding calc Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- res/css/views/directory/_NetworkDropdown.scss | 2 ++ src/components/structures/ContextMenu.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/res/css/views/directory/_NetworkDropdown.scss b/res/css/views/directory/_NetworkDropdown.scss index 269b507e3cb..dd1892c448c 100644 --- a/res/css/views/directory/_NetworkDropdown.scss +++ b/res/css/views/directory/_NetworkDropdown.scss @@ -35,6 +35,8 @@ limitations under the License. border-radius: 4px; border: 1px solid $dialog-close-fg-color; background-color: $primary-bg-color; + max-height: calc(100vh - 20px); // allow 10px padding on both top and bottom + overflow-y: auto; } .mx_NetworkDropdown_menu_network { diff --git a/src/components/structures/ContextMenu.js b/src/components/structures/ContextMenu.js index b4647a6c30a..98b0867ccc3 100644 --- a/src/components/structures/ContextMenu.js +++ b/src/components/structures/ContextMenu.js @@ -245,7 +245,6 @@ export class ContextMenu extends React.Component { } const contextMenuRect = this.state.contextMenuElem ? this.state.contextMenuElem.getBoundingClientRect() : null; - const padding = 10; const chevronOffset = {}; if (props.chevronFace) { @@ -264,7 +263,8 @@ export class ContextMenu extends React.Component { // If we know the dimensions of the context menu, adjust its position // such that it does not leave the (padded) window. if (contextMenuRect) { - adjusted = Math.min(position.top, document.body.clientHeight - contextMenuRect.height - padding); + const padding = 10; + adjusted = Math.min(position.top, document.body.clientHeight - contextMenuRect.height + padding); } position.top = adjusted;