Make WordPress Core

Opened 4 years ago

Closed 4 years ago

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

Custom Navigation blocks, appearing outside the UL on the frontend

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

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 4 years 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
4 years ago

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

#1 @costdev
4 years 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
4 years ago

  • Milestone Awaiting Review → 6.2.1
  • Version trunk → 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
4 years 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.


4 years ago

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


4 years ago

#6 @audrasjb
4 years ago

  • Keywords reporter-feedback removed
  • Milestone 6.2.1
  • Resolution → reported-upstream
  • Status new → 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.