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

Block directory doesn't work when blocks are hidden #38500

Open
ryelle opened this issue Feb 3, 2022 · 2 comments
Open

Block directory doesn't work when blocks are hidden #38500

ryelle opened this issue Feb 3, 2022 · 2 comments
Labels
[Feature] Block API API that allows to express the block paradigm. [Feature] Block Directory Related to the Block Directory, a repository of block plugins [Type] Bug An existing feature does not function as intended

Comments

@ryelle
Copy link
Contributor

ryelle commented Feb 3, 2022

Description

If you have any blocks hidden, the block directory won't load any external results. This is caused by the canInsertBlockType check, which checks against allowedBlockTypes. When there are hidden blocks, this list is set to the current registered blocks, minus those hidden blocks (source).

Since this is a safelist to match against, rather than a "disallowed" list, anything not on the list is blocked, and since it's created from locally registered blocks, nothing in the Block Directory is allowed.

Related to #33954

Step-by-step reproduction instructions

  1. Open an editor, go to Preferences > Blocks
  2. Uncheck some blocks
  3. Go back to the block inserter, try searching for a block in the directory — table, recipe, etc
  4. No results will load
  5. Unhide the blocks
  6. Try the search again, it should work

Screenshots, screen recording, code snippet

Screen.Recording.2022-02-03.at.12.49.18.PM.mov

Environment info

  • WP 6.0-alpha
  • Gutenberg trunk 7ab78a2
  • Theme: emptytheme
  • No other plugins

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@ryelle ryelle added the [Feature] Block Directory Related to the Block Directory, a repository of block plugins label Feb 3, 2022
@gziolo
Copy link
Member

gziolo commented Feb 24, 2022

Since this is a safelist to match against, rather than a "disallowed" list, anything not on the list is blocked, and since it's created from locally registered blocks, nothing in the Block Directory is allowed.

It looks like we finally need to implement a disallowedBlockTypes as an addition to allowedBlockTypes to resolve the issue reported in this issue. More importantly, it would give more flexibility over controlling blocks in different contexts.

@jordesign jordesign added the [Type] Bug An existing feature does not function as intended label Aug 30, 2023
@jordesign
Copy link
Contributor

Can confirm this is still present in WP6.3

@gziolo gziolo added the [Feature] Block API API that allows to express the block paradigm. label Aug 30, 2023
@gziolo gziolo mentioned this issue Sep 5, 2023
58 tasks
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] Block Directory Related to the Block Directory, a repository of block plugins [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants