Skip to content

Commit 4b36121

Browse files
committed
feat: Contain screenshot node in chart node
1 parent 6423eb0 commit 4b36121

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

app/components/chart-shared.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export const CHART_GRID_ROW_COUNT = 7;
7070
export const useChartStyles = makeStyles<Theme, { removeBorder?: boolean }>(
7171
(theme) => ({
7272
root: {
73+
position: "relative",
7374
flexGrow: 1,
7475
minWidth: 0,
7576
padding: theme.spacing(8),

app/utils/use-screenshot.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,12 @@ const makeScreenshot = async ({
9999
: false;
100100
// Add wrapper node to prevent overflow issues in the screenshot
101101
const wrapperNode = document.createElement("div");
102+
wrapperNode.style.position = "absolute";
103+
wrapperNode.style.left = "0";
104+
wrapperNode.style.top = "0";
105+
wrapperNode.style.zIndex = "999999";
102106
wrapperNode.style.width = `${node.offsetWidth}px`;
103-
document.body.appendChild(wrapperNode);
107+
node.appendChild(wrapperNode);
104108

105109
const clonedNode = node.cloneNode(true) as HTMLElement;
106110

0 commit comments

Comments
 (0)