fix: pdf viewer scroll elements

This commit is contained in:
David Nguyen
2026-02-06 14:59:52 +11:00
parent cb6d6e46d0
commit ab3e8a4074
17 changed files with 183 additions and 28 deletions
@@ -1,4 +1,4 @@
import { lazy, useEffect, useState } from 'react';
import { lazy, useEffect, useRef, useState } from 'react';
import { Trans } from '@lingui/react/macro';
import { type DocumentData, DocumentStatus, type EnvelopeItem, EnvelopeType } from '@prisma/client';
@@ -157,6 +157,7 @@ export const DocumentCertificateQRView = ({
envelopeItem={envelopeItems[0]}
token={token}
version="current"
scrollParentRef="window"
/>
</div>
</>
@@ -180,6 +181,8 @@ const DocumentCertificateQrV2 = ({
}: DocumentCertificateQrV2Props) => {
const { envelopeItems } = useCurrentEnvelopeRender();
const scrollableContainerRef = useRef<HTMLDivElement>(null);
return (
<div className="flex min-h-screen flex-col items-start">
<div className="flex w-full flex-col justify-between gap-4 md:flex-row md:items-end">
@@ -210,11 +213,12 @@ const DocumentCertificateQrV2 = ({
/>
</div>
<div className="mt-12 w-full">
<div className="mt-12 max-h-[80vh] w-full overflow-y-auto" ref={scrollableContainerRef}>
<EnvelopeRendererFileSelector className="mb-4 p-0" fields={[]} secondaryOverride={''} />
<EnvelopePdfViewer
customPageRenderer={EnvelopeGenericPageRenderer}
scrollParentRef={scrollableContainerRef}
errorMessage={PDF_VIEWER_ERROR_MESSAGES.preview}
/>
</div>
@@ -445,6 +445,7 @@ export const DocumentEditForm = ({
envelopeItem={document.envelopeItems[0]}
token={undefined}
version="current"
scrollParentRef="window"
onDocumentLoad={() => setIsDocumentPdfLoaded(true)}
/>
</CardContent>