Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cover block in content body overlaps mobile menu overlay #45353

Open
jamiepalatnik opened this issue Oct 27, 2022 · 12 comments
Open

Cover block in content body overlaps mobile menu overlay #45353

jamiepalatnik opened this issue Oct 27, 2022 · 12 comments
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image [Block] Navigation Affects the Navigation Block [Type] Bug An existing feature does not function as intended

Comments

@jamiepalatnik
Copy link

Description

When a Navigation block is added within a Cover block in the header template part, and then a Cover block (using background image and also contains a Post Title block) in the content body is rendered on mobile, the second Cover block overlaps the mobile menu overlay, as if the z-index is greater than the menu.

Step-by-step reproduction instructions

  1. In the site editor, create a header template part that is comprised of a Cover block that contains a Navigation block
  2. Also in the site editor, outside the header template part, create another Cover block with a background image and Post Title block
  3. Save changes, then preview the site in responsive view, particularly the mobile menu

The structure in the site editor should look like this:

Cover block 1

Screenshots, screen recording, code snippet

Screen recording:

Cover.block.issue.mp4

Environment info

  • WordPress Version 13.2.2
  • Gutenberg active
  • Tested on Chrome
  • Was able to reproduce on multiple themes, including Twenty Twenty-Two and Blockbase

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@DaisyOlsen DaisyOlsen added [Type] Bug An existing feature does not function as intended [Block] Cover Affects the Cover Block - used to display content laid over a background image labels Oct 31, 2022
@DaisyOlsen
Copy link
Contributor

Confirmed that this occurs when there is a Navigation block inside a cover block. Affects cover blocks in the content body.

@Jaykame
Copy link

Jaykame commented Dec 10, 2022

Ran into this with a user who using the blockbase theme and their Cover block on their site is covering their menu on mobile view. This appears to not only affect Cover Block inside the Navigation block but, like the other reported issue, it's happening when a Cover Block is inside content as well.

I recommend the user to use another block (Media and Text), and the issue was resolved.

@kathrynwp
Copy link

@renatho
Copy link
Contributor

renatho commented Oct 17, 2024

This could be closed after: #66093

@getdave
Copy link
Contributor

getdave commented Nov 27, 2024

I tested recently and placing Nav inside a Cover block in the header means that any submenus will be hidden underneath the main body content. Changing overflow to visible on Cover seems to resolve this

Image

@getdave getdave changed the title Cover block: Cover block in content body overlaps mobile menu overlay Cover block in content body overlaps mobile menu overlay Dec 2, 2024
@MaggieCabrera
Copy link
Contributor

I tested recently and placing Nav inside a Cover block in the header means that any submenus will be hidden underneath the main body content. Changing overflow to visible on Cover seems to resolve this

Looks like we need the overflow hidden for border radius to work

@MaggieCabrera
Copy link
Contributor

I tested recently and placing Nav inside a Cover block in the header means that any submenus will be hidden underneath the main body content. Changing overflow to visible on Cover seems to resolve this

Looks like we need the overflow hidden for border radius to work

I have looked into this a little more and I haven't found a solution.

My setup:

A cover block with an image in the background, set to fix background: I set a border with a noticeable width and I selected a border radius. Inside, a nav block with submenus, I positioned it close to the bottom with the cover controls, this makes the overflow issue very apparent.

What I tried:

  • Removing the overflow breaks the border radius and the image overlaps the borders that we set up for the cover
  • I tried setting the same border radius for .wp-block-cover__image-background and .wp-block-cover__background but that doesn't work if the border width is present, there is a noticeable gap between the border and the image
  • I tried messing with the z-index of wp-block-cover__inner-container but that doesn't seem to work (I wasn't really expecting it to)

I don't see an easy solution for this that doesn't require markup changes... I'll sleep on it see if I get a fresh idea.

@MaggieCabrera
Copy link
Contributor

A screenshot of the above removing overflow hidden:

Image

@getdave
Copy link
Contributor

getdave commented Dec 19, 2024

I tested child elements inheriting the border radius and it's promising.

That said, the overflow properties of the Cover block are what is causing us our problem with Navigation.

They seem to be added for sticky positioning. I wonder if they could be conditionally applied with a warning that this my "clip" dropdowns and popovers?

@getdave
Copy link
Contributor

getdave commented Dec 19, 2024

I also tested achieving the same layout with the Group block (including border radius) and there is no problem with the submenu dropdowns.

Image

@MaggieCabrera
Copy link
Contributor

I also tested achieving the same layout with the Group block (including border radius) and there is no problem with the submenu dropdowns.
Image

I did the same, now add a wide border to it plus the border radius

@MaggieCabrera
Copy link
Contributor

I did the same, now add a wide border to it plus the border radius

This is what I mean:

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image [Block] Navigation Affects the Navigation Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

7 participants