Skip to content

Navigation Submenu: Parent dropdown arrow and submenu container visible on viewports where all children are hidden #78147

Closed

Description

@BugReportOnWeb

Description

This was originally reported on WordPress Core Trac ticket here: https://core.trac.wordpress.org/ticket/64835

When all child items of a core/navigation-submenu block are hidden on a specific viewport block, the parent item still renders its dropdown arrow and submenu container on that viewport.

On further check, it looks like items hidden via "Hide on Desktop/Tablet/Mobile" still emit their full HTML and the hiding is handled purely by CSS via wp-block-hidden-* classes on the child <li>. So $inner_blocks_html is never empty, and $has_submenu is always true regardless of visibility settings.

$inner_blocks_html = '';
foreach ( $block->inner_blocks as $inner_block ) {
$inner_blocks_html .= $inner_block->render();
}
$has_submenu = ! empty( trim( $inner_blocks_html ) );

Step-by-step reproduction instructions

  1. Create a page with a Navigation block
  2. Add a submenu parent item
  3. Add one or more child links inside it
  4. For each child, click on three dots for block settings > Hide > select all viewport options.
  5. Save and preview on the front end

Expected: The parent item renders as a plain link with no dropdown arrow and no submenu container, since there are no visible children on
any viewport.

Actual: The parent item still shows a dropdown arrow and renders an empty submenu container

Screenshots, screen recording, code snippet

Image

Environment info

  • WordPress: 7.1-alpha-62201
  • PHP: 8.3.30
  • Server: Apache/2.4.66 (Debian)
  • Database: mysqli (Server: 11.8.6-MariaDB-ubu2404 / Client: mysqlnd 8.3.30)
  • Browser: Chrome 146.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.4
  • MU Plugins: None activated
  • Plugins:
    • Gutenberg 23.1.0-rc.1
    • Test Reports 1.2.1

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Activity

  1. youknowriad commented on Aug 27, 2026

    @youknowriad
    Contributor

    I'm closing this issue per @jeryj's comment on the PR.

  2. jeryj commented on Aug 27, 2026

    @jeryj
    Contributor

    I think it's still a valid issue - I just wasn't sure about the fix in #78148. Should we reopen this?

  3. youknowriad commented on Aug 27, 2026

    @youknowriad
    Contributor

    I thought you said, it's too edge casy. I'm fine either way, your call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

[Feature] Navigation MenusAny issue relating to Navigation Menus[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions