Skip to content
Merged
Prev Previous commit
Next Next commit
Add data-level to fix issue in Firefox
  • Loading branch information
andrewserong committed May 1, 2023
commit 41a1f9cfb475d0b2507567092c6a6c3a6e9d714c
1 change: 1 addition & 0 deletions packages/block-editor/src/components/list-view/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ function ListViewBlock( {
id={ `list-view-${ listViewInstanceId }-block-${ clientId }` }
data-block={ clientId }
data-expanded={ canExpand ? isExpanded : undefined }
data-level={ level }
ref={ rowRef }
>
<TreeGridCell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@ export default function useListViewDropZone() {
const blocksData = blockElements.map( ( blockElement ) => {
const clientId = blockElement.dataset.block;
const isExpanded = blockElement.dataset.expanded === 'true';
const nestingLevel = blockElement.dataset.level
? parseInt( blockElement.dataset.level, 10 )
: undefined;
const rootClientId = getBlockRootClientId( clientId );

return {
Expand All @@ -378,7 +381,7 @@ export default function useListViewDropZone() {
rootClientId,
blockIndex: getBlockIndex( clientId ),
element: blockElement,
nestingLevel: blockElement.ariaLevel,
nestingLevel,
isDraggedBlock: isBlockDrag
? draggedBlockClientIds.includes( clientId )
: false,
Expand Down