Skip to content

Render effective Navigation submenu settings without persisting repairs - #5

Closed
adamziel wants to merge 1 commit into
fix/passive-render-dirty-entitiesfrom
try/effective-navigation-submenu-settings
Closed

adamziel wants to merge 1 commit into
fix/passive-render-dirty-entitiesfrom
try/effective-navigation-submenu-settings

Conversation

@adamziel

Copy link
Copy Markdown
Owner

What

This is a draft follow-up to WordPress#79000 that explores the render-time/effective-value approach suggested in review.

Instead of repairing the stale horizontal Navigation submenuVisibility: "always" state with setAttributes, this branch treats that impossible combination as the horizontal default while rendering/editor UI runs:

  • effective submenuVisibility: hover
  • effective showSubmenuIcon: true

The stored block attributes are left untouched unless the user makes an explicit attribute change.

Why

PR WordPress#79000 prevents passive rendering from dirtying related entities, but selecting the stale Navigation block can still dirty the template part because the repair effect still writes attributes. This draft removes that effect and applies the effective values to editor rendering/context instead.

The PHP render path also coerces the same impossible combination before rendering, so pre-existing stored invalid attributes do not render differently between editor and frontend.

Notes / risks to review

  • This intentionally changes how pre-existing horizontal Navigation blocks with submenuVisibility: "always" are interpreted at render time.
  • Inline Navigation inner blocks are rebuilt with effective context only when the effective attributes differ from stored attributes; this is to keep child block context consistent without changing the common path.
  • This does not make impossible states unrepresentable. A deeper data-model/UI change would still be needed for that.

Testing

  • php -l packages/block-library/src/navigation/index.php
  • node --check test/e2e/specs/editor/blocks/navigation-passive-rendering.spec.js
  • git diff --check
  • wp-scripts format --check packages/block-library/src/navigation/edit/index.js test/e2e/specs/editor/blocks/navigation-passive-rendering.spec.js

Local wp-env/E2E is still blocked in this workspace because Docker/OrbStack is not running.

@adamziel

Copy link
Copy Markdown
Owner Author

Closing; this draft belongs in WordPress/gutenberg instead.

@adamziel adamziel closed this Jun 17, 2026
@github-actions

Copy link
Copy Markdown

Size Change: +64 B (0%)

Total Size: 8.6 MB

📦 View Changed
Filename Size Change
build/scripts/block-library/index.min.js 324 kB +64 B (+0.02%)

compressed-size-action

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.

1 participant