-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically set reusable
to false
when a block has a parent
defined
#35223
Comments
So you are proposing that all block types that have a parent or multiple parents explicitly defined should never be set as reusable blocks. I tend to agree with that. @WordPress/gutenberg-core, what do you think? |
I'm inclined to agree. |
@gziolo I would love it to not be as strict. I think that it would be a great default and I cannot currently see any examples where you would want it. But that doesn't mean there isn't one. So if we can make it work in a way where the developer could still set reusable to true explicitly to override the default value I think that would be the most flexible solution. |
Seems like a good idea... but being able to override the default would be great and there would be no downsides to doing it. |
I bet we don't check the context when inserting a reusable block so that's a related area that needs further improvements. To ensure that the reusable block can be inserted only in the place where the outer block would be. To give an example, if the Button block has parent set as the Buttons block and you make Button reusable, then you should be able to insert it only inside the Buttons block. |
@fabiankaegy @gziolo checking with the both of you to see if this is something worth pursuing still? |
Yes, it is still a valid issue, and it looks like we agreed on the way to address it. It shouldn't be that much work to implement it so maybe it could even be a candidate for a |
Hi @fabiankaegy, @gziolo I have created a PR for this issue. Let me know if anything needs to be updated. |
What problem does this address?
When a block defines a
parent
that means that it gets hidden from the inserter unless you are trying to insert it into the defined parent. The block also cannot be moved outside of the container. However, it is still possible to select the "child" block and make it reusable. You can circumvent this by settingreusable
tofalse
but I think that should be the default behavior when a block has aparent
defined.What is your proposed solution?
The possible solution for this would be to automatically set the
reusable
flag tofalse
by default for when a block has aparent
defined.The text was updated successfully, but these errors were encountered: