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

Navigation block overlay padding zero clamp calculation fails for zero values #61398

Open
djcowan opened this issue May 6, 2024 · 5 comments · May be fixed by #61697
Open

Navigation block overlay padding zero clamp calculation fails for zero values #61398

djcowan opened this issue May 6, 2024 · 5 comments · May be fixed by #61697
Labels
[Block] Navigation Affects the Navigation Block Needs Testing Needs further testing to be confirmed. [Status] In Progress Tracking issues with work in progress [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. [Type] Bug An existing feature does not function as intended

Comments

@djcowan
Copy link
Contributor

djcowan commented May 6, 2024

Description

The padding on the navigation responsive container is calculated using a clamp function.
The clamp calculation uses the --wp--style--root--padding-xyz - which fails when any of the units are set to zero (0)
Our site don't require a value for top or bottom.

padding: 
clamp(1rem, var(--wp--style--root--padding-top), 20rem) //<-- is zero
clamp(1rem, var(--wp--style--root--padding-right), 20rem) 
clamp(1rem, var(--wp--style--root--padding-bottom), 20rem) // <-- is zero
clamp(1rem, var(--wp--style--root--padding-left), 20em);

Step-by-step reproduction instructions

  1. Go the the Style editor > Layout
  2. Set top and bottom to zero
  3. open the responsive menu container on mobile
  4. calc function fails - no padding applied
    zero

Screenshots, screen recording, code snippet

No response

Environment info

WordPress 6.5.2 running our Custom block theme
Gutenberg - Version 18.2.0
Mac/Windows, iOS

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

@djcowan djcowan added the [Type] Bug An existing feature does not function as intended label May 6, 2024
@hanneslsm
Copy link

hanneslsm commented May 6, 2024

I can confirm this issue. I have also noticed it with a new custom theme but haven't had time to investigate it yet. Clamp calculation as the cause makes sense - my theme also doesn't have a top padding.

@djcowan
Copy link
Contributor Author

djcowan commented May 7, 2024

We sidestep by setting 0.01em and fix it when it breaks.

@jordesign jordesign added Needs Testing Needs further testing to be confirmed. [Block] Navigation Affects the Navigation Block labels May 13, 2024
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label May 15, 2024
@amitraj2203
Copy link
Contributor

Hi @djcowan and @jordesign, I have raised a PR for this issue. Please have a look at it and let me know if it needs improvement.

Thank You!

@hanneslsm
Copy link

It looks like the issue is also solved when using 0px instead of 0

hanneslsm added a commit to hanneslsm/prolooks that referenced this issue Jun 13, 2024
Copy link

Hi,
This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps.
Thanks for helping out.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Jul 14, 2024
@getdave getdave changed the title block-navigation responsive-container zero clamp calculation Navigation block overlay padding zero clamp calculation fails for zero values Nov 21, 2024
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 Needs Testing Needs further testing to be confirmed. [Status] In Progress Tracking issues with work in progress [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. [Type] Bug An existing feature does not function as intended
Projects
None yet
4 participants