[wp-trac] [WordPress Trac] #46964: ID attribute value are used multiple times in "Custom Field" form

WordPress Trac noreply at wordpress.org
Fri Feb 28 04:26:53 UTC 2020


#46964: ID attribute value are used multiple times in "Custom Field" form
-------------------------------------------------+-------------------------
 Reporter:  jankimoradiya                        |       Owner:  audrasjb
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  5.4
Component:  Editor                               |     Version:  5.0
 Severity:  normal                               |  Resolution:
 Keywords:  has-screenshots has-patch early      |     Focuses:  ui,
  needs-dev-note                                 |  accessibility
-------------------------------------------------+-------------------------

Comment (by azaozz):

 46964.4.diff looks good here.

 A better way to fix this would be to change
 `the_block_editor_meta_boxes()` to more closely resemble the HTML
 outputted from edit-form-advanced.php. Looking there, the HTML elements
 with matching IDs are outputted in a loop...

 A fix would probably look like:

 {{{

 <div id="poststuff" class="sidebar-open">
 <?php foreach ( $locations as $i => $location ) : ?>
         <form class="metabox-location-<?php echo esc_attr( $location );
 ?>" onsubmit="return false;">
                 <div id="postbox-container-<?php echo ( 1 + $i ); ?>"
 class="postbox-container">
                         <?php
                         do_meta_boxes(
                                 $current_screen,
                                 $location,
                                 $post
                         );
                         ?>
                 </div>
         </form>
 <?php endforeach; ?>
 </div>
 }}}

 (move the `poststuff` div outside of the loop and make the `postbox-
 container-*` IDs dynamic to match edit-form-advanced.php).

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


More information about the wp-trac mailing list