Skip to content

Editor: Center navigation (and template parts/patterns) in canvas view mode#75735

Closed
Copilot wants to merge 2 commits intotrunkfrom
copilot/fix-276006-80862584-e916ee13-7e6f-4e2c-8db5-68487354240c
Closed

Editor: Center navigation (and template parts/patterns) in canvas view mode#75735
Copilot wants to merge 2 commits intotrunkfrom
copilot/fix-276006-80862584-e916ee13-7e6f-4e2c-8db5-68487354240c

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 19, 2026

In the Site Editor nav view (canvas=view), the navigation preview renders top-left aligned — then visually jumps to centered when entering edit mode. This is both hard to read and disorienting.

Root cause: The iframe centering CSS (display:flex; align-items:center; justify-content:center on .block-editor-iframe__html) was gated entirely on enableResizing, which is explicitly disabled in preview/view mode (! isPreview). Centering and resizing were conflated in a single flag.

Change — packages/editor/src/components/visual-editor/index.js:

  • Extract isNavigationOrDesignPostType (wp_navigation, wp_template_part, wp_block) from the enableResizing condition
  • Apply iframe centering CSS based on isNavigationOrDesignPostType (view and edit modes) rather than enableResizing (edit mode only)
  • enableResizing and the min-height:0!important guard on .is-root-container are unchanged — resizing remains edit-mode only
// Before: centering tied to enableResizing (edit mode only)
enableResizing
  ? `.block-editor-iframe__html{...display:flex;align-items:center;...}`
  : ''

// After: centering for design post types regardless of preview mode
isNavigationOrDesignPostType
  ? `.block-editor-iframe__html{...display:flex;align-items:center;...}`
  : ''

The same fix benefits template parts and patterns in their respective view-mode previews, which share the same rendering path.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • translate.wordpress.org
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node i18n-cache/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Center Navigation Preview in Site Editor Nav View</issue_title>
<issue_description>## What problem does this address?

The current navigation is aligned top and left with zero padding. Then when you click into the canvas area, it becomes center/centered. It's hard to perceive in the top and it's disorienting when it moves.

What is your proposed solution?

Center the navigation vertically and horizontally in the preview pane.

Current View

Navigation aligned top left with zero padding

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: jeryj <967608+jeryj@users.noreply.github.com>
Copilot AI changed the title [WIP] Center Navigation Preview in Site Editor Nav View Editor: Center navigation (and template parts/patterns) in canvas view mode Feb 19, 2026
Copilot AI requested a review from jeryj February 19, 2026 16:17
@jeryj
Copy link
Copy Markdown
Contributor

jeryj commented Feb 19, 2026

Not quite. Closing and creating myself instead of directing copilot for this one.

@jeryj jeryj closed this Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Center Navigation Preview in Site Editor Nav View

2 participants