Skip to content

Fix sub-menu background color inheritance from nav-menu block settings #262

Merged
RachelRVasquez merged 2 commits into
strangerstudios:memberlite-footer-variationsfrom
kimcoleman:submenu-color-fix
Apr 16, 2026
Merged

Fix sub-menu background color inheritance from nav-menu block settings #262
RachelRVasquez merged 2 commits into
strangerstudios:memberlite-footer-variationsfrom
kimcoleman:submenu-color-fix

Conversation

@kimcoleman

Copy link
Copy Markdown
Member

All Submissions:

Changes proposed in this Pull Request:

When a background color is assigned to the memberlite/nav-menu block in the editor, it was only applied to the
outer

element. The dropdown .sub-menu flyouts kept the theme's default nav background instead.

This PR bridges the gap using a CSS custom property (--memberlite-color-navigation-block-background), which does
inherit through the cascade including to absolutely-positioned descendants.

  • render.php: detects the block's background color (preset slug or custom hex) and injects it as --memberlite-color-navigation-block-background via get_block_wrapper_attributes().
  • _header.scss: .sub-menu background-color now uses var(--memberlite-color-navigation-block-background, var(--memberlite-color-site-navigation-background)), falling back to the theme default when no block color is
    set

How to test the changes in this Pull Request:

  1. Create a header with the Nav block.
  2. Choose a menu with dropdown items.
  3. Set a background color using either a named color or a custom color via color picker.

Observe on the frontend that the bg color cascades to the sub menu.

You can also NOT set any custom bg color and instead, change the Customizer > Colors setting for Primary Navigation bg. Without colors set on the nav menu block directly, the sub-menu should inherit that theme-wide color setting.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully run tests with your changes locally?

…block itself for its bg color to the member info block. Fix in header-02 pattern for this compat.
@RachelRVasquez RachelRVasquez merged commit f15eae7 into strangerstudios:memberlite-footer-variations Apr 16, 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.

2 participants