-
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
Block Inserter Category and Output Heuristics #62300
Conversation
Size Change: +150 B (+0.01%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@ellatrix Curious on your feedback for if this code is an improvement performance wise or if I'm over-thinking it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me this is not a "code quality" PR, there's a change in behaviour. |
Curious why you think |
Yes, I noticed that too and mentioned it above. I was thinking about redefining the heuristics so if it has a lot of blocks within it, such as the group block, then it outputs things within the normal categories. Trying to get a feel for different options.
I wasn't sure what to categorize it as since it's not a bug and it may not be an enhancement in its current state :)
It's doing a lot of things for the initial category that aren't necessary, like grouping into collections, outputting most used blocks. I think it could be simpler to pass one list of items and categories, so I'm trying it out. I'll probably drop close this PR, but I was curious to see how it was in practice. |
Instead of having two blockTypesTabPanels, just use one by adding our current category as the top level item and put all blocks (without groupings) within it. I'm not sure if this change will be desired though.
cfd83b9
to
ff6ff5b
Compare
@WordPress/gutenberg-design - Can I get feedback on the UX of the inserter category heuristics here? I think this is an improvement to the output and organization of the block inserter categories when we have block filtering relative to the selected block. |
If I understand this correctly. An example would be having a specific WooCommerce block selected in Canvas view and then seeing other WooCommerce blocks on the top of the Block inserter to give a signal to the user a relation of the selected block to other similar blocks in the Block inserter. It can be very helpful to create a relation between a selected block in Canvas view <-> seeing more focused blocks in the Block inserter. Gradually over time an user can notice the relation. Then might on purpose select specific blocks in Canvas view to get related blocks in the Block inserter. |
Thanks for the PR. While the behavior in trunk isn't necessarily the most intuitively understandable, there's something obvious about the sorting in categories of inserts in selected block and inserts after, but the behavior for the Group block, feels like it bridges those two gaps in an intuitive way. Reducing duplication, and showing towards the top the most useful and common blocks you'd likely insert contextually, that feels valid enough. But it's not clear this brings benefits to the actual user experience, especially for the group block. I could very well be missing nuance, however, the trunk behavior I haven't had a chance to absorb fully yet. |
Closing for now, but we can open this exploration up later if needed. |
Some polish for the new inserter category output:
Only output one "most used" categories list. If there is a selected block, this goes beneath the allowed selected blocks.
Adds current block name as the category title for its allowed blocks
If no block is selected/default empty block, output all categories and blocks as it was in past versions of WordPress.
If a block is selected, filter the available blocks.
What?
Improves the UX for the block inserter category output.
Why?
Polish the UX, as there are some areas that feel off, such as:
How?
Adds
selectedBlockItems
andselectedBlockCategories
props added to the<BlockTypesTabPanel />
component and only outputs this component once.Testing Instructions
Default State
Selected block with One Category Item
Selected block with Multiple Categories
Selected Block with almost all available blocks
Testing Instructions for Keyboard
Screenshots or screencast
Screen.Recording.2024-06-07.at.10.51.19.AM.mov