-
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
Enhance Block Card and Inspector Controls with Secondary Description #68438
base: trunk
Are you sure you want to change the base?
Conversation
- Added a new InspectorControls slot for secondary descriptions in BlockCard component. - Updated styles for the secondary description to include italic font and margin. - Integrated secondary description in the SearchEdit component's InspectorControls.
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. |
Size Change: +92 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
Flaky tests detected in a1a8797. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12562027725
|
I don't have a deep understanding of #68438, but in regards to this PR, it's worth noting that a similar slot existed in the past (#49819). This private slot was removed in #67189 because it's no longer used in core blocks. In any case, if we add a new slot, I recommend exposing it as a private API. Maybe we can use #49819's implementation as it is? |
It looks very similar to:
A private slot existed for some time and was used by the Query block, but it was removed: I think similar concerns apply here, as this slot allows us to put basically every React component, which was raised by many folks as a blocking factor. |
Based on the history around the previous slot and that block's Is the use case to show a different description on some cases only? Could we achieve that maybe with block variations? |
Thanks for your comments folks!
@ntsekouras The use case is to support the following design detail in the Instant Search functionality of the Search block: I hear the concerns about the potential for abuse, but I'm not convinced that it's a serious problem. I echo Greg's comment. Adding any content to the Inspector Controls with some custom CSS and JS is already possible - it's just a bit harder. What if we:
Would that be acceptable? |
If we decide that there is a valid use case in core to have an additional slot there (which I can see both sides of to be clear) we should make it possible for any block to use this. For that reason, I firmly believe the option to introduce this as a private API is not acceptable. |
100% agree with that. There should be consistency in how all blocks are handled. |
What?
Adds a new InspectorControls slot for a secondary block description.
Why?
It's needed it for the UI that was designed for the Instant Search functionality of the Query + Search blocks (#67181)
More details in this comment: #67181 (comment)
How?
By adding the
<InspectorControls.Slot group="secondaryDescription"/>
in the BlockCard and creating the relevant groups.Testing Instructions
You can test it e.g. by adding the following snippet in
packages/block-library/src/search/edit.js
: