Skip to content

Conversation

@getdave
Copy link
Contributor

@getdave getdave commented Nov 25, 2025

What

This PR is a prototype exploring an overlay editing experience for the Navigation block. It allows users to edit overlay template parts directly within the Navigation block's responsive wrapper, providing a "spotlight editing" experience where the overlay content can be edited inline without navigating away from the Navigation block.

This exploration is complementary to #73389, which explores the same overlay editing concept but via focused template part editing mode. Together, these prototypes explore different approaches to editing navigation overlays: one using focused template part editing (navigating to a separate editor), and this one using inline spotlight editing (editing within the Navigation block context).

Why

We're exploring how to provide a more seamless editing experience for navigation overlays. This prototype tests an alternative approach to #73389 by allowing users to edit overlay content directly within the Navigation block context, making it easier to see how changes affect the overall navigation experience without navigating away.

How

  • Renders overlay template parts directly within the Navigation block's responsive wrapper
  • Conditionally shows either standard navigation blocks or overlay template part blocks based on overlay selection
  • Provides a "Close Overlay" control that's shared across all sub-blocks within the overlay
  • Updates the "Edit Overlay" button in the sidebar to toggle the overlay open/closed instead of navigating
  • Locks the template part block to prevent removal while allowing content editing
  • Enables pattern insertion for overlay template parts via the Design panel

Testing Instructions

  1. Basic Overlay Editing:

    • Add a Navigation block to a page
    • In the Navigation block sidebar, select an overlay template part (or create a new one)
    • Click "Edit Overlay" - the responsive menu should open showing the overlay content
    • Edit blocks within the overlay inline
    • Click "Close Overlay" in any block's toolbar to close and return to the Navigation block
  2. Edit/Close Overlay Button:

    • With an overlay selected, verify the sidebar button shows "Edit Overlay" when closed
    • Open the overlay and verify the button changes to "Close Overlay"
    • Clicking the button should toggle the overlay state
  3. Shared Close Control:

    • Open the overlay
    • Navigate to any sub-block within the overlay
    • Verify the "Close Overlay" button appears in the toolbar
    • Verify it does NOT appear on the template-part block itself
    • Clicking it should close the overlay and select the parent Navigation block
  4. Pattern Insertion:

    • With the overlay open, select the template-part block
    • Open the Design panel in the sidebar
    • Verify patterns are available for insertion
    • Insert a pattern and verify it works correctly

Current Limitations

⚠️ Prototype Code: This is experimental code intended for exploration. Some shortcuts and lo-fidelity implementations are acceptable for this prototype phase.

- Add full-height editor display for overlay template parts
- Create Overlay Close block (core/overlay-close) restricted to overlay template parts
- Add overlayTemplatePartId attribute to Navigation block
- Add overlay selector control in Navigation block Display panel
- Register overlay-close block in block library

This is a working editor-only prototype for customizable Navigation Overlays.
Front-end PHP rendering is not included.
- Change overlayTemplatePartId attribute type from number to string
- Update OverlaySelector to handle string IDs like 'twentytwentyfive//my-new-overlay'
- Simplify component implementation and remove parseInt conversion
- Add Edit Overlay button below the select control
- Button is disabled when no overlay is selected
- Button navigates to template part editor when clicked
- Add pencil icon to button
- Use VStack for vertical spacing between select and button
- Set button max-width to fit-content to prevent full-width stretching
- Create new Overlay PanelBody in Navigation block inspector
- Move overlay menu preview, overlay menu toggle, and overlay template part selector from Display ToolsPanel to Overlay panel
- Add VStack spacing for proper control spacing in Overlay panel
- Update Display ToolsPanel to remove overlay controls
- Add help text to overlay template part selector
- Panel opens by default (initialOpen={true})
- Keep overlay color controls in Color group (unchanged)
- Detect if Navigation block is inside an overlay template part
- Hide Overlay panel when inside an overlay template part
- Override overlayMenu to 'never' and overlayTemplatePartId to undefined when inside overlay
- Prevents nested overlays (overlay inception)
- Rename 'Overlay Menu' label to 'Overlay Visibility' for clarity
- Update ResponsiveWrapper to accept overlayTemplatePartId and onNavigateToEntityRecord props
- Modify toggle button click handler to navigate to overlay template part editor when overlayTemplatePartId is set
- Navigate to overlay template part editor when clicking the responsive container toggle button (hamburger menu)
- Falls back to normal toggle behavior if no overlay template part is set
- Pass navigation props to both ResponsiveWrapper instances
- Register overlay template part area in WordPress 7.0 compatibility layer
- Gate overlay area registration behind experiment flag
- Generate unique overlay names when creating new overlays (Overlay, Overlay 2, etc.)
- Remove console.log debug statement
- Ensure each overlay has a distinct name in the list
- Conditionally render OverlaySelector only when overlayMenu is not 'never'
- Preserve overlayTemplatePartId attribute when controls are hidden
- Add code comment noting PHP rendering must account for this situation
- Ensures configured overlay remains available if user toggles back to Mobile/Always
- Create OverlayTemplatePartInnerBlocks component to render and edit overlay template part blocks inline
- Conditionally render overlay template part blocks when overlay is open and custom overlay is selected
- Remove navigation logic from responsive wrapper open button to match trunk behavior
- Hide close button when custom overlay is set
- Remove padding/margin from responsive container and content when custom overlay is active
- Set width and height to 100% for overlay container elements
- Force root level blocks to 100% width in custom overlay content
- Create OverlayToggleContext to provide overlay state to child blocks
- Add filter to inject close overlay button into all block toolbars when in overlay
- Update OverlayTemplatePartInnerBlocks to provide context
- Add CSS styling for custom overlay (remove padding/margin, set 100% width/height)
- Hide close button in responsive wrapper when custom overlay is set
- Replace useEntityBlockEditor with rendering core/template-part block
- Lock template-part block to prevent removal
- Add width/height 100% styling for container and inner block editor elements
- Exclude template-part blocks from overlay toggle control
- Improve CSS selectors for overlay container elements
- Add overlay to supported areas for Design panel and Replace button
- Fix useAlternativeBlockPatterns to use clientId instead of rootClientId for overlay patterns
- This ensures overlay patterns are found when template part is nested in navigation block
- Update overlay toggle context to include navigation block clientId
- Use selectBlock to select navigation block before closing overlay
- Pass navigationClientId through to overlay template part component
- Change Edit Overlay action to toggle overlay open/closed
- Show 'Close Overlay' when overlay is open, 'Edit Overlay' when closed
- Pass overlay open state to OverlaySelector component
- Enable button when overlay is open even if canEdit is false
@getdave getdave self-assigned this Nov 25, 2025
@getdave
Copy link
Contributor Author

getdave commented Dec 10, 2025

Closing in favour of #73389

@getdave getdave closed this Dec 10, 2025
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.

2 participants