Skip to content

Commit

Permalink
List view: add drag cursor to draggable list items (#57493)
Browse files Browse the repository at this point in the history
* Add drag cursor to draggable list items

* Use more specific classes

* Remove :hover and show pointer on the expander
  • Loading branch information
ramonjd authored Jan 4, 2024
1 parent 5f6467d commit 832ae44
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/block-editor/src/components/list-view/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function ListViewBlock( {
const [ isHovered, setIsHovered ] = useState( false );
const [ settingsAnchorRect, setSettingsAnchorRect ] = useState();

const { isLocked, canEdit } = useBlockLock( clientId );
const { isLocked, canEdit, canMove } = useBlockLock( clientId );

const isFirstSelectedBlock =
isSelected && selectedClientIds[ 0 ] === clientId;
Expand Down Expand Up @@ -269,6 +269,7 @@ function ListViewBlock( {
'is-dragging': isDragged,
'has-single-cell': ! showBlockActions,
'is-synced': blockInformation?.isSynced,
'is-draggable': canMove,
} );

// Only include all selected blocks if the currently clicked on block
Expand Down
6 changes: 6 additions & 0 deletions packages/block-editor/src/components/list-view/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
// Use position relative for row animation.
position: relative;

&.is-draggable,
&.is-draggable .block-editor-list-view-block-contents {
cursor: grab;
}

.block-editor-list-view-block-select-button {
// When a row is expanded, retain the dark color.
&[aria-expanded="true"] {
Expand Down Expand Up @@ -378,6 +383,7 @@
height: $icon-size;
margin-left: $grid-unit-05;
width: $icon-size;
cursor: pointer;
}

// First level of indentation is aria-level 2, max indent is 8.
Expand Down

0 comments on commit 832ae44

Please sign in to comment.