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

Introduce a UI for setting allowedBlocks in blocks that support it #62703

Open
mtias opened this issue Jun 20, 2024 · 10 comments
Open

Introduce a UI for setting allowedBlocks in blocks that support it #62703

mtias opened this issue Jun 20, 2024 · 10 comments
Labels
[Feature] Block API API that allows to express the block paradigm. [Feature] Extensibility The ability to extend blocks or the editing experience [Type] Enhancement A suggestion for improvement.

Comments

@mtias
Copy link
Member

mtias commented Jun 20, 2024

Container blocks already support an allowedBlocks attribute in the markup to express what blocks can be inserted. This is a very cool feature that can allow site creators to provide highly usable flows without needing to create entirely custom blocks. It can be tedious to write by hand, though, so we could explore exposing UI for it in the Advanced panel. The interface should be similar to the block manager design.

Here's a prototype outlining an interface for managing allowed blocks. Essentially, we can use a secondary button with the label 'Manage':

Secondary button with inserter

And it opens up this modal providing the ability to search through the list and select with checkboxes.

  • Searching (list filtration) works the same as in the preferences modal from the block manager.
  • Order of blocks in the list is also the same.

✨ Mockup:
Modal Opened

This can be way easier for users to recognize and easily scan the blocks they want to allow, and they're already used to this pattern (from the preference modal) so it's quite familiar.

Note: See also the discussion for an important added aspect of needing a way to differentiate between the state when all blocks are allowed, and when only a subset is. One suggestion is to add a subheading in the quick inserter, when only a subset is allowed.

✒️ And here's the figma file.

Props @seifeldinio for the design work.

@mtias mtias added [Type] Enhancement A suggestion for improvement. [Feature] Block API API that allows to express the block paradigm. [Feature] Extensibility The ability to extend blocks or the editing experience labels Jun 20, 2024
@talldan talldan added the Needs Design Needs design efforts. label Jun 21, 2024
@seifeldinio

This comment was marked as resolved.

@jasmussen jasmussen added Needs Design Feedback Needs general design feedback. and removed Needs Design Needs design efforts. labels Jun 26, 2024
@jasmussen

This comment was marked as outdated.

@mtias

This comment was marked as resolved.

@seifeldinio

This comment was marked as resolved.

@jasmussen
Copy link
Contributor

Nice work, that looks good! I'll let others chime in with feedback if they have any, otherwise this sounds close to migrating to "Needs dev" territory. Thanks for contributing 👌

@jasmussen jasmussen added Needs Dev Ready for, and needs developer efforts and removed Needs Design Feedback Needs general design feedback. labels Jul 12, 2024
@jasmussen
Copy link
Contributor

Following up on this one, given no pushback on the proposed approach, I've updated the original issue and added the "Needs Dev" label. Thank you and kudos to @seifeldinio for the work!

@mtias mtias removed the Needs Dev Ready for, and needs developer efforts label Jul 12, 2024
@mtias
Copy link
Member Author

mtias commented Jul 12, 2024

@jasmussen I think we need a way to communicate the status once certain blocks are allowed. From the mockup it seems the normal state (all blocks allowed) displays the same as a managed state (a few blocks allowed).

@jasmussen
Copy link
Contributor

I think we need a way to communicate the status once certain blocks are allowed. From the mockup it seems the normal state (all blocks allowed) displays the same as a managed state (a few blocks allowed).

Here's a quick differentiation:

differentiation

Essentially, when only a subset is allowed, we show a subheading—"Allowed blocks"—in the quick inserter.

@mtias
Copy link
Member Author

mtias commented Aug 2, 2024

@jasmussen this is not what I had in mind—the thing that is not clear is this element:

image

Once blocks are set I expect to see which ones are set without having to click "manage".

@jasmussen
Copy link
Contributor

Ah thanks for chiming in. Something like this perhaps?
differentiation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. [Feature] Extensibility The ability to extend blocks or the editing experience [Type] Enhancement A suggestion for improvement.
4 participants