Skip to content

Commit 85a4160

Browse files
jsnajdrntsekouras
andauthored
Dataviews: use inertValue in CompositeGrid (#84072)
* Dataviews: use inertValue in CompositeGrid * Fix prop value in parent component Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
1 parent e1c9f1f commit 85a4160

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

‎packages/dataviews/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
### Bug Fixes
1313

14+
- Grid layout: Apply `inert` through `inertValue` so the attribute works reliably ([#84072](https://github.com/WordPress/gutenberg/pull/84072)).
1415
- Keep filter and item actions menus dismissible when their triggers become disabled ([#83791](https://github.com/WordPress/gutenberg/pull/83791)).
1516
- Grid layout: measure the container as the grid attaches rather than waiting for the resize observer's first report, so the grid no longer renders a frame with every item in a full-width column of its own before snapping to its real column count ([#83752](https://github.com/WordPress/gutenberg/pull/83752)).
1617

‎packages/dataviews/src/components/dataviews-layouts/grid/composite-grid.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
useRef,
1616
forwardRef,
1717
} from '@wordpress/element';
18+
import { inertValue } from '@wordpress/react-inert-value';
1819
import { MEDIA_ASPECT_RATIOS } from '../../../constants';
1920
import ItemActions from '../../dataviews-item-actions';
2021
import DataViewsSelectionCheckbox from '../../dataviews-selection-checkbox';
@@ -343,7 +344,7 @@ export default function CompositeGrid< Item >( {
343344
data,
344345
isInfiniteScroll,
345346
className,
346-
inert,
347+
inert = false,
347348
isLoading,
348349
view,
349350
fields,
@@ -453,7 +454,7 @@ export default function CompositeGrid< Item >( {
453454
role="feed"
454455
focusWrap
455456
// @ts-expect-error `inert` is not declared in React 18's HTML attribute types.
456-
inert={ inert }
457+
inert={ inertValue( inert ) }
457458
>
458459
{ /* Render placeholders for unloaded items in first row */ }
459460
{ Array.from( { length: placeholdersNeeded } ).map(
@@ -551,7 +552,7 @@ export default function CompositeGrid< Item >( {
551552
aria-rowcount={ totalRows }
552553
ref={ resizeObserverRef }
553554
// @ts-expect-error `inert` is not declared in React 18's HTML attribute types.
554-
inert={ inert }
555+
inert={ inertValue( inert ) }
555556
>
556557
{ chunk( data, gridColumns ).map( ( row, i ) => (
557558
<Composite.Row

‎packages/dataviews/src/components/dataviews-layouts/grid/index.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import clsx from 'clsx';
22
import { Spinner } from '@wordpress/components';
33
import { __, sprintf } from '@wordpress/i18n';
4-
import { inertValue } from '@wordpress/react-inert-value';
54
import { Stack } from '@wordpress/ui';
65
import type { ViewGridProps } from '../../../types';
76
import getDataByGroup from '../utils/get-data-by-group';
@@ -63,7 +62,7 @@ function ViewGrid< Item >( {
6362
className: clsx( className, {
6463
'is-refreshing': ! isInfiniteScroll && isDelayedLoading,
6564
} ),
66-
inert: inertValue( ! isInfiniteScroll && isLoading ),
65+
inert: ! isInfiniteScroll && !! isLoading,
6766
isLoading,
6867
view,
6968
fields,

0 commit comments

Comments
 (0)