Make WordPress Core

#57992 closed defect (bug) (reported-upstream)

Custom Navigation blocks, appearing outside the UL on the frontend

Reported by: krugazul's profile krugazul Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.1
Component: Menus Keywords:
Focuses: Cc:

Description

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.

Attachments (1)

Screenshot 2023-03-27 at 16.20.17.png (118.1 KB) - added by krugazul 13 months ago.
A custom naviagtion block outputting between a link block and a submenu block. See how there are 2 <ul> items

Download all attachments as: .zip

Change History (7)

@krugazul
13 months ago

A custom naviagtion block outputting between a link block and a submenu block. See how there are 2 <ul> items

#1 @costdev
13 months ago

  • Keywords reporter-feedback added

Hi @krugazul, welcome to Trac and thanks for opening this ticket.

This should be reported on the Gutenberg GitHub repository. Can you please open a new bug report to report this issue and drop a link here when it's been created? Thanks!

#2 @costdev
13 months ago

  • Milestone changed from Awaiting Review to 6.2.1
  • Version changed from trunk to 6.1

This is reproducible on WordPress 6.1. Updating the Version property and keeping this ticket open for tracking purposes. Milestoning for 6.2.1.

Possible related issue: https://github.com/WordPress/gutenberg/pull/46387

#3 @krugazul
13 months ago

@costdev I have created an Issue on Github - https://github.com/WordPress/gutenberg/issues/49394

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


12 months ago

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


12 months ago

#6 @audrasjb
12 months ago

  • Keywords reporter-feedback removed
  • Milestone 6.2.1 deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed

As per today's 6.2.1 bug scrub, let's close this ticket as reported upstream on Gutenberg repository. Further comments should be added in the related issue on Github.

Note: See TracTickets for help on using tickets.