Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

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

Merged
merged 1 commit into from
Apr 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions res/css/views/directory/_NetworkDropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/components/structures/ContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down