Skip to content

Inherit styles for custom overlays in navigation - #79109

Open
yyppsk wants to merge 3 commits into
WordPress:trunkfrom
yyppsk:fix/navigation-overlay-style-inheritance
Open

yyppsk wants to merge 3 commits into
WordPress:trunkfrom
yyppsk:fix/navigation-overlay-style-inheritance

Conversation

@yyppsk

@yyppsk yyppsk commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

What?

Closes #79078

Updates custom Navigation overlays so Navigation blocks inside the overlay template part inherit the parent Navigation block's text color and typography styles when they do not define their own values.

Why?

When creating a custom overlay from a styled Navigation block, the nested menu in the generated overlay template part could appear visually plain in the editor. On the frontend, inheritance was inconsistent: some styles, such as color and font appearance, could carry through, while font size did not.

This makes the custom overlay start from the same visual baseline as the Navigation block that created it, while still allowing the overlay template part to be customized independently afterward.

How?

  • Passes the parent Navigation block attributes into the overlay template part creation flow.
  • Seeds generated overlay Navigation blocks with inherited text color and typography attributes.
  • Applies the same inheritance on the server when rendering existing custom overlay template parts.
  • Preserves explicit styles already set on the overlay template part's own Navigation block.
  • Keeps the menu open icon controlled by the parent Navigation block, since that icon belongs to the outer Navigation instance rather than the overlay template part.

Testing Instructions

  1. Open the Site Editor.
  2. Edit a template part that contains a Navigation block, such as the Header.
  3. Select or insert a Navigation block.
  4. Set the Navigation block's overlay menu to Always.
  5. Apply visible styles to the parent Navigation block:
    • Text color, for example red.
    • Font size, for example large or x-large.
    • Font appearance or weight, for example italic or bold.
    • Optional: font family, text transform, or letter spacing.
  6. In the Navigation block sidebar, click Create overlay.
  7. Confirm that the Navigation block inside the new Navigation Overlay template part shows the inherited color and typography styles.
  8. Save the overlay template part.
  9. Return to the template or page where the parent Navigation block is used and save changes.
  10. View the frontend and open the menu overlay.
  11. Confirm that the overlay menu items use the inherited text color and typography styles.
  12. Edit the overlay template part's inner Navigation block and set a different text color or typography value.
  13. Save and confirm on the frontend that the explicit overlay style is preserved and overrides the inherited parent style.

Testing Instructions for Keyboard

  1. Open the Site Editor.
  2. Use keyboard navigation to select the Navigation block.
  3. Open the block settings sidebar.
  4. Use the keyboard to set the overlay menu to Always.
  5. Use the keyboard to apply a text color and typography settings to the Navigation block.
  6. Tab to the Create overlay button and activate it with Enter or Space.
  7. Confirm focus moves to the Navigation Overlay template part editor.
  8. Use keyboard navigation to select the inner Navigation block and verify its inherited style settings.
  9. Save using the keyboard.
  10. Open the frontend, tab to the menu button, activate it with Enter or Space, and confirm the overlay menu opens with the inherited styles.

Screencast

Before Fix

Before_Fix.mp4

After Fix

After_Fix.mp4

Use of AI Tools

This PR was authored with assistance from OpenAI Codex. I reviewed the changes and manually verified the behaviour.

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Jun 11, 2026
@yyppsk
yyppsk marked this pull request as ready for review June 11, 2026 10:53
@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Block] Navigation Affects the Navigation Block labels Jun 14, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

🤖 PR meta 🤖

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: yyppsk <pranjalpratapsingh@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

This branch has not been deployed

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

Labels

[Block] Navigation Affects the Navigation Block [Package] Block library /packages/block-library [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Navigation block: Nested menu in a custom overlay inconsistently inherits styles

2 participants