feat: remove sticky headers

This commit is contained in:
Florian Duros 2026-03-12 13:20:43 +01:00
parent d2fb62254d
commit 05430c915d
No known key found for this signature in database
GPG Key ID: A5BBB4041B493F15

View File

@ -5,7 +5,7 @@
* Please see LICENSE files in the repository root for full details.
*/
import React, { type JSX, useCallback, useMemo, useRef } from "react";
import React, { type JSX, useCallback, useMemo, useRef, type PropsWithChildren } from "react";
import { GroupedVirtuoso } from "react-virtuoso";
import { useVirtualizedList, type VirtualizedListContext, type VirtualizedListProps } from "../virtualized-list";
@ -241,6 +241,18 @@ export function GroupedVirtualizedList<Header, Item, Context>(
[getGroupHeaderComponent, onFocusForHeader, groups],
);
// Remove sticky headers
const components = useMemo(
() => ({
TopItemList: ({ children, ...rest }: PropsWithChildren<{ style?: React.CSSProperties }>) => (
<div {...rest} style={{ ...rest.style, position: "relative" }}>
{children}
</div>
),
}),
[],
);
return (
<GroupedVirtuoso
// note that either the container of direct children must be focusable to be axe
@ -251,6 +263,7 @@ export function GroupedVirtualizedList<Header, Item, Context>(
itemContent={getItemComponentInternal}
groupContent={getGroupHeaderComponentInternal}
{...virtuosoProps}
components={components}
/>
);
}