Skip to content

Disabled blocks passed to BlockTypesList are no longer draggable#42751

Merged
talldan merged 2 commits intoWordPress:trunkfrom
kjohnson:patch-3
Jul 28, 2022
Merged

Disabled blocks passed to BlockTypesList are no longer draggable#42751
talldan merged 2 commits intoWordPress:trunkfrom
kjohnson:patch-3

Conversation

@kjohnson
Copy link
Copy Markdown
Contributor

@kjohnson kjohnson commented Jul 27, 2022

Resolves #42749

Related impress-org/givewp-next-gen#44

What?

This PR prevents disabled items in the BlockTypesList from being draggable.

Why?

Items that are disabled should not be draggable.

How?

This PR accounts for an item's isDisabled property value when assigning isDraggable to the corresponding InserterListItem.

Testing Instructions

  1. Create an item object for consumption by the BlockTypesList
  2. Set isDisabled on that object to true.
  3. Pass the item in an array to the BlockTypesList component.
  4. The rendered item should not be draggable.

Screenshots or screencast

Before

Peek 2022-07-27 16-21

After

Peek 2022-07-27 16-22

@kjohnson kjohnson marked this pull request as ready for review July 27, 2022 20:26
@kjohnson kjohnson requested a review from ellatrix as a code owner July 27, 2022 20:26
@talldan talldan added [Type] Bug An existing feature does not function as intended [Feature] Blocks Overall functionality of blocks [Feature] Drag and Drop Drag and drop functionality when working with blocks labels Jul 28, 2022
Copy link
Copy Markdown
Contributor

@talldan talldan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

I tested using the More block in the post editor (which has multiple set to false), and this successfully resolves the issue.

@talldan talldan merged commit 357f729 into WordPress:trunk Jul 28, 2022
@github-actions github-actions bot added this to the Gutenberg 13.9 milestone Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Blocks Overall functionality of blocks [Feature] Drag and Drop Drag and drop functionality when working with blocks [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disabled items in the BlockTypesList should not be draggable

2 participants