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

Fix/submenu long items wrap #4153

Merged
merged 5 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions e2e-tests/specs/customizer/hfg/hfg-menu-item-wrap.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { test, expect } from '@playwright/test';

test.describe('Menu item alignment', function () {
test.use({ viewport: { width: 600, height: 900 } });

test('Checks mobile menu submenu item wrap', async ({ page }) => {
await page.goto('/');
await page.getByRole('button', { name: 'Navigation Menu' }).click();
await page
.getByRole('button', { name: 'Toggle About The Tests' })
.click();

const firstLevelItem = page
.locator('#nv-primary-navigation-sidebar')
.getByRole('link', {
name: 'Page Markup And Formatting',
});
await firstLevelItem.isVisible();
await expect(firstLevelItem).toHaveCSS('white-space', 'normal');

await page.getByRole('button', { name: 'Toggle Level 1' }).click();

await page.getByRole('button', { name: 'Toggle Level 2' }).click();

const secondLevelItem = page
.locator('#nv-primary-navigation-sidebar')
.getByRole('link', {
name: 'Level 3b',
});
});
});
1 change: 1 addition & 0 deletions inc/views/nav_walker.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public function get_mobile_caret_style() {
$mobile_button_caret_css .= '.header-menu-sidebar .nav-ul li .wrap a { flex-grow: 1; display: flex; }';
$mobile_button_caret_css .= '.header-menu-sidebar .nav-ul li .wrap a .dd-title { width: var(--wrapdropdownwidth); }';
$mobile_button_caret_css .= '.header-menu-sidebar .nav-ul li .wrap button { border: 0; z-index: 1; background: 0; }';
$mobile_button_caret_css .= '.header-menu-sidebar .nav-ul li:not([class*=block]):not(.menu-item-has-children) > .wrap > a { padding-right: calc(1em + (18px*2)); text-wrap: wrap; white-space: normal;}';
$mobile_button_caret_css .= '.header-menu-sidebar .nav-ul li.menu-item-has-children:not([class*=block]) > .wrap > a { margin-right: calc(-1em - (18px*2));}';

return Dynamic_Css::minify_css( $mobile_button_caret_css );
Expand Down
Loading