close
Skip to content

Navigation submenus hidden when editing template parts #73024

@albanyacademy

Description

@albanyacademy

Description

When editing a header template, for example, opening a submenu to add more links doesn't visibly do anything, as the submenu is clipped by the editor canvas.

Image

I tried to identify what exactly was causing this and got a little lost - could see where the height prop was getting passed to the resizable editor comp, but not where it was getting refreshed from. Any pointers would be appreciated!

Was able to kinda hack something together in a BlockEdit filter to instead manually adjust the editor canvas based on the submenu's owner document's scollHeight, instead of offsetHeight or something similar (sorry, kinda gross):

	useLayoutEffect( () => {
		if ( ! document.querySelector( '.edit-site-visual-editor__editor-canvas' ) || ! ref?.current?.ownerDocument?.body?.scrollHeight ) {
			return;
		}
		const editor = document.querySelector( '.editor-resizable-editor' );
		editor.style.setProperty( 'height', `${ ref?.current?.ownerDocument?.body?.scrollHeight }px` );
	}, [ isVisible ] );

Anyhow, yeah. Kinda weird experience, had a few clients complain about it.

Step-by-step reproduction instructions

  1. Create a template part (header)
  2. Add a nav block to it
  3. Add a submenu to that nav block
  4. Click the submenu block
  5. Image

Screenshots, screen recording, code snippet

No response

Environment info

No response

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] NavigationAffects the Navigation Block[Status] Needs More InfoFollow-up required in order to be actionable.[Status] StaleGives the original author opportunity to update before closing. Can be reopened as needed.[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