Skip to content

Commit

Permalink
retrieve top panel height instead of hardcoding it
Browse files Browse the repository at this point in the history
Signed-off-by: Jonah Iden <[email protected]>
  • Loading branch information
jonah-iden committed Nov 6, 2024
1 parent 8e56b2c commit 697649a
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,11 @@ export class ElectronContextMenuRenderer extends BrowserContextMenuRenderer {
} else {
const menuAccess = super.doRender(options);
const node = (menuAccess as BrowserContextMenuAccess).menu.node;
const topPanelHeight = document.getElementById('theia-top-panel')?.clientHeight ?? 0;
// ensure the context menu is not displayed outside of the main area
if (node.style.top && parseInt(node.style.top.substring(0, node.style.top.length - 2)) < 32) {
node.style.top = '32px';
node.style.maxHeight = `calc(${node.style.maxHeight} - 32px)`;
if (node.style.top && parseInt(node.style.top.substring(0, node.style.top.length - 2)) < topPanelHeight) {
node.style.top = `${topPanelHeight}px`;
node.style.maxHeight = `calc(${node.style.maxHeight} - ${topPanelHeight}px)`;
}
return menuAccess;
}
Expand Down

0 comments on commit 697649a

Please sign in to comment.