Block Bindings: Hide Attributes panel for Date, Nav Link, and Nav Submenu blocks#72712
Conversation
|
Size Change: +6 B (0%) Total Size: 2.37 MB
ℹ️ View Unchanged
|
|
Barring a "global" solution (e.g. attribute However, we don't currently seem to allow for this kind of granular control, so this is the best compromise I could find. |
|
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. |
cbravobernal
left a comment
There was a problem hiding this comment.
LGTM
Ping @getdave for the navigation one.
|
Flaky tests detected in e176f31. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18845010573
|
|
It makes sense. It could be also an allow list, similar to Pattern Overrides if you want to lock it down to specific use cases. It also looks like only block types that handle rich-text connected attributes as strings really can be supported as these attributes by nature don’t have restrictions on what to put there. For non-string attributes it’s rather easier as filtering works out of the box. |
|
I've been AFK but I"ll review this today. |
…menu blocks (#72712) * Block Bindings: Hide Attributes panel for Date, Nav Link, and Nav Submenu blocks * Update e2e test Co-authored-by: ockham <bernhard-reiter@git.wordpress.org> Co-authored-by: cbravobernal <cbravobernal@git.wordpress.org> Co-authored-by: gziolo <gziolo@git.wordpress.org> Co-authored-by: getdave <get_dave@git.wordpress.org>
|
I just cherry-picked this PR to the wp/6.9 branch to get it included in the next release: ff437c9 |
|
Yesterday didn't go as planned. However, I tested this in |
What?
Do not render the "Attributes" panel in the block inspector for the Date, Navigation Link, and Navigation Submenu blocks.
Why?
This is a workaround to prevent those blocks' attributes to be bound to incompatible sources. For example, binding the Date block'
datetimeattribute to any value provided by a block bindings source that's not a date/time will break that block. The same applies to the Navigation Link and Navigation Submenu blocks'urlattribute -- it should only be bound to URLs. (Block bindings support for those blocks was only added during the 6.9 cycle, so the Attributes panel wasn't shown for them in 6.8.)In the long term, the fix should probably involve a
formatfield in a block'sattributesdefinition inblock.json(see). Barring that, this workaround will at least prevent blocks being broken by being bound badly.How?
By using the Attributes panel's
hasSupportpredicate and filtering by block name.Testing Instructions
(In all those cases, the functionality that uses block bindings for those blocks is provided through different parts of the UI instead; e.g. for the Date block, it's through its block variations.)
Screenshots or screencast
Shown here for the Post Date block variation: