[wp-trac] [WordPress Trac] #60572: block_core_navigation_render_inner_blocks loses caret for parent items
WordPress Trac
noreply at wordpress.org
Mon Feb 19 12:18:58 UTC 2024
#60572: block_core_navigation_render_inner_blocks loses caret for parent items
--------------------------+-----------------------------
Reporter: anaid | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 6.4.3
Severity: minor | Keywords:
Focuses: |
--------------------------+-----------------------------
When we build a menu via the blocks editor the regular way, and create a
parent menu items with a submenu, the parent menu item is (somehow) marked
as a parent. It receives a caret automatically in Twenty Twenty Four
theme.
When programmatically creating a menu via
`block_core_navigation_render_inner_blocks`, the parent-child relationship
is not marked automatically. There is no dropdown caret in the parent menu
item.
Reproduction scenario:
- Twenty Twenty Four theme
- Go to Editor and manually create Navigation
- Parent item "Post A"
- Add a submenu
- Child item "Post B"
- View the website. Post A is parent, has a dropdown caret and Post B is
below it
Now, do it programmatically via block_core_navigation_render_inner_blocks:
{{{
function block_core_navigation_render_inner_blocks($items)
{
return new WP_Block_List(array(
new WP_Block([
'blockName' => 'core/navigation-link',
'attrs' => ["label" => "Post A"],
'innerBlocks' => array(new WP_Block([
'blockName' => 'core
/navigation-link',
'attrs' => ["label" =>
"Post B"],
'innerBlocks' => [],
'innerHTML' => '',
'innerContent' => [],
])),
'innerHTML' => '',
'innerContent' => [],
])
));
}
}}}
View the website. There is no dropdown caret applied to the parent post
(Post A)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60572>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list