diff --git a/packages/dmn-editor/src/overlaysPanel/OverlaysPanel.tsx b/packages/dmn-editor/src/overlaysPanel/OverlaysPanel.tsx index c76695df516..d95666eae26 100644 --- a/packages/dmn-editor/src/overlaysPanel/OverlaysPanel.tsx +++ b/packages/dmn-editor/src/overlaysPanel/OverlaysPanel.tsx @@ -43,17 +43,18 @@ export function OverlaysPanel({ availableHeight }: OverlaysPanelProps) { const overlayPanelContainer = useRef(null); useLayoutEffect(() => { if (overlayPanelContainer.current && availableHeight) { - const bounds = overlayPanelContainer.current.getBoundingClientRect(); - const currentHeight = bounds.height; - const yPos = bounds.y; - if (currentHeight + yPos >= availableHeight) { + if (overlayPanelContainer.current.scrollHeight <= availableHeight) { + overlayPanelContainer.current.style.overflowY = "hidden"; + overlayPanelContainer.current.style.height = "auto"; + } else if ( + overlayPanelContainer.current.style.height !== availableHeight - BOTTOM_MARGIN + "px" && + overlayPanelContainer.current.style.height !== "auto" + ) { overlayPanelContainer.current.style.height = availableHeight - BOTTOM_MARGIN + "px"; - overlayPanelContainer.current.style.overflowY = "scroll"; - } else { - overlayPanelContainer.current.style.overflowY = "visible"; + overlayPanelContainer.current.style.overflowY = "auto"; } } - }); + }, [availableHeight]); return (