Skip to content
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

Consider Group blocks to be removed if all child blocks are removed #34943

Open
richtabor opened this issue Sep 19, 2021 · 7 comments
Open

Consider Group blocks to be removed if all child blocks are removed #34943

richtabor opened this issue Sep 19, 2021 · 7 comments
Labels
[Block] Group Affects the Group Block (and row, stack and grid variants) Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.

Comments

@richtabor
Copy link
Member

What problem does this address?

Empty Group blocks are difficult to select and can cause "holes" in a page's design that are hard to identify (as they are invisible when empty and not selected).

What is your proposed solution?

Consider Group blocks to be removed if all child blocks are also removed, as:

  1. There is no purpose for empty Group blocks on a page
  2. They cause the problems above

I was inspired by this through how Figma handles empty groups — which are similar in theory:

github.mp4
@richtabor richtabor added Needs Design Feedback Needs general design feedback. [Block] Group Affects the Group Block (and row, stack and grid variants) labels Sep 19, 2021
@talldan
Copy link
Contributor

talldan commented Sep 20, 2021

I think there has been similar feedback and a similar issue for the button block too. Would definitely be good to explore 👍

@jasmussen
Copy link
Contributor

Works so well in Figma! A question to ponder, though: if you start by inserting a group block, then deselect and save the page, what happens then? Arguably what makes it work in Figma is that the group is mostly an organizational tool secondary to the content.

@karmatosed
Copy link
Member

I also totally agree if you have added content and then removed it, an empty group block doesn't make sense. Can the group block be aware though of the state either being that it did contain content or was being used as a placeholder by just being added? That I feel is what is being suggested by you sort of @jasmussen where someone might just add blocks to a page?

@ellatrix
Copy link
Member

Ha! This is similar to #40979, which would be fixed by #42503. I was wondering if the behaviour could be generalised so we can remove the inner blocks setting.

@jasmussen
Copy link
Contributor

It would be tricky for Columns, where each Column inside would technically start out empty. There's also this state if you insert an empty group:

Screenshot 2023-08-16 at 16 57 38

So I wonder if the potentially generalized solution shouldn't be: if a container already has content and you remove the last block, then the container can be removed as well. Tricky bit here would be that if you remove the last block from the last Column inside of a Columns block, both the Column and the Columns block should be remove. Right?

@richtabor
Copy link
Member Author

Tricky bit here would be that if you remove the last block from the last Column inside of a Columns block, both the Column and the Columns block should be remove. Right?

I think perhaps the rule only works per one nested level up. It wouldn't delete the Columns block, just the column (which it already does).

@jasmussen
Copy link
Contributor

Actually that seems fine:

deleting columns

I had pictured a different outcome when deleting the last column, which is thankfully not the case. (Though we do need to update that columns placeholder state to be more like that of Group.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Group Affects the Group Block (and row, stack and grid variants) Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

6 participants