[wp-trac] [WordPress Trac] #57992: Custom Navigation blocks, appearing outside the UL on the frontend

WordPress Trac noreply at wordpress.org
Mon Mar 27 14:23:30 UTC 2023


#57992: Custom Navigation blocks, appearing outside the UL on the frontend
--------------------------+-----------------------------
 Reporter:  krugazul      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Menus         |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 **Description**
 When assigning a custom block to the navigation block,  the
 `render_block_core_navigation` outputs the custom block outside of the UL,
 when on the frontend.


 **Source**
 This array of nav "list items" and "items needing a list wrapper" is
 defined here - https://github.com/WordPress/wordpress-
 develop/blob/trunk/src/wp-includes/blocks/navigation.php#L702-L713

 The custom block is included in the `$inner_blocks` variable. But when it
 loops through them, the custom block triggers the closing of the <ul>
 prematurely.

 That is because a custom block, fails the list item check here.
 [https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-
 includes/blocks/navigation.php#L718]


 **Possible Option**
 A filter to allows us to add the names of custom blocks that should be
 treated a "list items".  i.e filter the `$list_item_nav_blocks` variable.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57992>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list