Skip to content

Commit 948d0fc

Browse files
MaggieCabrerascruffiangetdave
authored andcommitted
Navigation block: fix padding on mobile overlay when global padding is 0 (#53725)
* force min value for padding to be 2rem * fallback for when the css variables are not defined * Allow the padding to be smaller than 2rem * Add fix to avoid trigger hover state on links when overlay opens --------- Co-authored-by: scruffian <ben@scruffian.com> Co-authored-by: Dave Smith <getdavemail@gmail.com>
1 parent 8602fc1 commit 948d0fc

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/block-library/src/navigation/style.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -506,10 +506,10 @@ button.wp-block-navigation-item__content {
506506
@include reduce-motion("animation");
507507

508508
// Try to inherit any root paddings set, so the X can align to a top-right aligned menu.
509-
padding-top: var(--wp--style--root--padding-top, 2rem);
510-
padding-right: var(--wp--style--root--padding-right, 2rem);
511-
padding-bottom: var(--wp--style--root--padding-bottom, 2rem);
512-
padding-left: var(--wp--style--root--padding-left, 2rem);
509+
padding-top: clamp(1rem, var(--wp--style--root--padding-top), 20rem);
510+
padding-right: clamp(1rem, var(--wp--style--root--padding-right), 20rem);
511+
padding-bottom: clamp(1rem, var(--wp--style--root--padding-bottom), 20rem);
512+
padding-left: clamp(1rem, var(--wp--style--root--padding-left), 20em);
513513

514514
// Allow modal to scroll.
515515
overflow: auto;

test/e2e/specs/editor/blocks/navigation-colors.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,10 @@ class ColorControl {
413413
.getByRole( 'button', { name: 'Open menu' } )
414414
.click();
415415

416+
// Move the mouse to avoid accidentally triggering hover
417+
// state on the links once the overlay opens.
418+
await this.page.mouse.move( 1000, 1000 );
419+
416420
const overlay = this.editor.canvas
417421
.locator( '.wp-block-navigation__responsive-container' )
418422
.filter( { hasText: 'Submenu Link' } );

0 commit comments

Comments
 (0)