[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:12:44 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:
-----------------------------+-----------------------
Changes (by dmsnell):

 * keywords:  has-patch has-unit-tests =>


Comment:

 Thanks for raising this important point of tension! And this only
 highlights the tip of the iceberg when it comes to blocks supporting block
 bindings. The `<figcaption>` example is a good case to review, but //any//
 and //every// block that does //anything// other than outputting a static
 HTML structure independent of its attributes will face this same problem
 and many will have no clear automatic resolution.

 One thing worth keeping in mind is the cost of adding new complexity in
 Core to try and automate this or fix blocks. With every resolution we
 dissociate the rendering of the block from the JS code in `save()` and we
 do so by adding compound conditionals.

 At some point it may be easier, substantially less cognitive overhead, and
 easier to maintain due to the parallel construction of writing a rendering
 function in PHP for blocks with this characteristic. That way the JS and
 PHP code can be discussed, people already know how to write JS and PHP,
 and Core doesn’t need the machinery to make expensive guesses.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63919#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list