Allow network dropdown to be scrollable and fix context menu window padding calc

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2020-04-14 17:34:39 +01:00
parent 69e680da3c
commit 769cf1c987
2 changed files with 4 additions and 2 deletions

View File

@ -35,6 +35,8 @@ limitations under the License.
border-radius: 4px; border-radius: 4px;
border: 1px solid $dialog-close-fg-color; border: 1px solid $dialog-close-fg-color;
background-color: $primary-bg-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 { .mx_NetworkDropdown_menu_network {

View File

@ -245,7 +245,6 @@ export class ContextMenu extends React.Component {
} }
const contextMenuRect = this.state.contextMenuElem ? this.state.contextMenuElem.getBoundingClientRect() : null; const contextMenuRect = this.state.contextMenuElem ? this.state.contextMenuElem.getBoundingClientRect() : null;
const padding = 10;
const chevronOffset = {}; const chevronOffset = {};
if (props.chevronFace) { 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 // If we know the dimensions of the context menu, adjust its position
// such that it does not leave the (padded) window. // such that it does not leave the (padded) window.
if (contextMenuRect) { 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; position.top = adjusted;