mirror of
https://github.com/vector-im/element-web.git
synced 2026-04-14 18:11:28 +02:00
feat: remove sticky headers
This commit is contained in:
parent
d2fb62254d
commit
05430c915d
@ -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}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user