[wp-trac] [WordPress Trac] #63919: Block Bindings: Conditional rendering of HTML elements corresponding to block attrs
WordPress Trac
noreply at wordpress.org
Wed Sep 3 15:06:32 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 | Keywords:
Focuses: |
-----------------------------+----------------------
An Image block will only include a `<figcaption>` HTML element in its
saved markup if the block's `caption` attribute is not empty; the same
applies to the Pullquote block's `citation` attribute, which corresponds
to a `<cite>` element.
This poses a problem when adding Block Bindings support for those
attributes, as the Block Bindings logic depends on the presence of those
HTML elements in order to replace their inner HTML with the value obtained
from the respective Block Bindings source.
One possible solution is to change the editor-side block logic so that
includes those HTML elements whenever the corresponding attribute is bound
to a Block Bindings source. This change needs to be made to the block
JavaScript code, i.e. inside of Gutenberg.
This approach needs to be complemented by server-side logic that will
remove those HTML elements prior to rendering if their value is empty.
(E.g. if the Block Bindings source did not return a non-empty value for
the given attribute after all.)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63919>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list