Skip to content

Commit 687d781

Browse files
committed
update table loading sentinel styles for non-virtualized tables in Safari
position absolute/relative is not really well supported in Safari making the loading sentinel not scroll into view when scrolling the table
1 parent 4669b74 commit 687d781

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

packages/react-aria-components/src/Table.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,8 +1399,10 @@ export const UNSTABLE_TableLoadingSentinel = createLeafComponent('loader', funct
13991399
<>
14001400
{/* Alway render the sentinel. For now onus is on the user for styling when using flex + gap (this would introduce a gap even though it doesn't take room) */}
14011401
{/* @ts-ignore - compatibility with React < 19 */}
1402-
<TR style={{position: 'relative', width: 0, height: 0}} inert={inertValue(true)} >
1403-
<TD data-testid="loadMoreSentinel" ref={sentinelRef} style={{position: 'absolute', height: 1, width: 1}} />
1402+
<TR style={{height: 0}} inert={inertValue(true)}>
1403+
<TD style={{padding: 0, border: 0}}>
1404+
<div data-testid="loadMoreSentinel" ref={sentinelRef} style={{position: 'relative', height: 1, width: 1}} />
1405+
</TD>
14041406
</TR>
14051407
{isLoading && renderProps.children && (
14061408
<TR

packages/react-aria-components/stories/Table.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@ const MyTableLoadingIndicator = (props) => {
538538
// These styles will make the load more spinner sticky. A user would know if their table is virtualized and thus could control this styling if they wanted to
539539
// TODO: this doesn't work because the virtualizer wrapper around the table body has overflow: hidden. Perhaps could change this by extending the table layout and
540540
// making the layoutInfo for the table body have allowOverflow
541-
<UNSTABLE_TableLoadingSentinel style={{height: 30, position: 'sticky', top: 0, left: 0, width: tableWidth}} {...otherProps}>
542-
<LoadingSpinner style={{height: 20, width: 20, transform: 'translate(-50%, -50%)'}} />
541+
<UNSTABLE_TableLoadingSentinel style={{height: 30, width: tableWidth}} {...otherProps}>
542+
<LoadingSpinner style={{height: 20, position: 'unset'}} />
543543
</UNSTABLE_TableLoadingSentinel>
544544
);
545545
};

0 commit comments

Comments
 (0)