Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kie-issues#1679 : If the bottom of the overlay panel is close to editor bottom, it adds a vertical overflow after toggling an option #2845

Merged
merged 4 commits into from
Jan 28, 2025
Merged
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
17 changes: 9 additions & 8 deletions packages/dmn-editor/src/overlaysPanel/OverlaysPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,18 @@ export function OverlaysPanel({ availableHeight }: OverlaysPanelProps) {
const overlayPanelContainer = useRef<HTMLDivElement>(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 (
<div ref={overlayPanelContainer}>
Expand Down
Loading