Skip to content
Draft
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/components/FindWalletProductTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const FindWalletProductTable = ({ wallets }: { wallets: WalletRow[] }) => {
)}
filters={filters}
matomoEventCategory="find-wallet"
estimateSize={300}
/>
</>
)}
Expand Down
24 changes: 23 additions & 1 deletion src/components/ProductTable/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ type ListProps<T extends { id: string }> = {
) => React.ReactNode
matomoEventCategory: string
filters: FilterOption[]
estimateSize: number
}

const List = <T extends { id: string }>({
data,
subComponent,
matomoEventCategory,
filters,
estimateSize,
}: ListProps<T>) => {
const [expanded, setExpanded] = useState<Record<string, boolean>>({})

Expand All @@ -36,7 +38,7 @@ const List = <T extends { id: string }>({

const virtualizer = useWindowVirtualizer({
count: data.length,
estimateSize: () => 300,
estimateSize: () => estimateSize,
overscan: 5,
scrollMargin: parentOffsetRef.current,
})
Expand Down Expand Up @@ -90,6 +92,26 @@ const List = <T extends { id: string }>({
height: `${virtualizer.getTotalSize()}px`,
}}
>
<div aria-hidden="true" style={{ position: "absolute", inset: 0 }}>
{data.map((item, index) => (
<div
key={`search-ghost-${item.id}`}
style={{
position: "absolute",
left: 0,
width: "100%",
// Approximate vertical position using your estimate and scrollMargin
transform: `translateY(${estimateSize * index - virtualizer.options.scrollMargin}px)`,
opacity: 0,
pointerEvents: "none",
// Ensure it contributes text for Ctrl+F but avoids layout
height: 0,
}}
>
{(item as unknown as Wallet).name}
</div>
))}
</div>
{virtualizer.getVirtualItems().map((virtualItem) => {
const item = data[virtualItem.index]

Expand Down