Unitless root padding causes Navigation Overlay default minimum padding to become "no padding" #67837
Open
3 of 6 tasks
Labels
[Block] Navigation
Affects the Navigation Block
[Type] Bug
An existing feature does not function as intended
Description
In #53725 Navigation Overlay has a padding set to utilise the global site root padding value, but with a default fallback value of
1em
in cases where the root padding value has been set to0
:gutenberg/packages/block-library/src/navigation/style.scss
Lines 509 to 513 in b66f9ff
Unfortunately the way the
clamp()
function works means that you cannot have a unit-less value as the "preferred value" (i.e. the 2nd argument). If a unit-less value is provided then it will be utilised instead of the default value. Therefore if--wp--style--root--padding-top
is set to0
(as opposed to say0px
) then the resulting padding values will be set to0px
instead of the desired1rem
fallback.This is a problem for sites that use the standard Editor tools to control the padding on the site and end up with a mobile overlay which looks broken.
Step-by-step reproduction instructions
Padding
slide to 0. Note ensure you do not use a custom value as that will include thepx
value whereas the slider results in a unit-less0
.Console
drawer in dev toolswp-block-navigation__responsive-container hidden-by-default has-modal-open is-menu-open
.clamp
function.Computer tab
in the devtools console to see the resulting computedpadding
values.0px
and not1rem
.0px
. Note you will need to save a new value like10px
first and then reset to0px
else the editor will not interpret this as a dirty state.1rem
.Screenshots, screen recording, code snippet
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
The text was updated successfully, but these errors were encountered: