[wp-trac] [WordPress Trac] #63919: Block Bindings: Conditional rendering of HTML elements corresponding to block attrs
WordPress Trac
noreply at wordpress.org
Thu Sep 18 13:45:53 UTC 2025
#63919: Block Bindings: Conditional rendering of HTML elements corresponding to
block attrs
-----------------------------+-----------------------
Reporter: Bernhard Reiter | Owner: (none)
Type: enhancement | Status: assigned
Priority: normal | Milestone: 6.9
Component: General | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
-----------------------------+-----------------------
Comment (by Bernhard Reiter):
We recently landed [https://github.com/WordPress/gutenberg/pull/71483 this
PR] which saves an Image block's `<figcaption>` as part of the block
markup if its `caption` attribute is bound to a block bindings source.
(Conversely, if the attribute is empty and isn't bound, the `<figcaption>`
won't be included in the markup.)
This still leaves us with the case where the block bindings source returns
an empty value for `caption`, in which case the `<figcaption>` should be
removed prior to rendering.
Based on the discussion on this ticket and some conversations with @gziolo
and @cbravobernal, we're now thinking that this should be the individual
block's responsibility. This seems like a reasonable requirement,
especially since a "generic" solution at WP Core level that removes those
elements based on some criteria seems too fragile and error-prone (unless
enabled by a special placeholder syntax, which would also come at a cost).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63919#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list