fix(menu): prevent mobile dropdown click from auto-focusing search

This commit is contained in:
Xin
2026-03-06 23:04:41 +00:00
committed by GitHub
parent 1317e5697f
commit c2417dc24f
3 changed files with 31 additions and 6 deletions

View File

@@ -0,0 +1,21 @@
import { test, expect } from "@playwright/test";
test("clicking mobile hamburger does not focus the sidebar search input", async ({
page,
}) => {
await page.setViewportSize({ width: 375, height: 812 });
await page.goto("/", { waitUntil: "load" });
const menuButton = page.locator(".hextra-hamburger-menu");
await expect(menuButton).toBeVisible();
const sidebarSearchInput = page
.locator(".hextra-sidebar-container .hextra-search-input")
.first();
await expect(sidebarSearchInput).toBeVisible();
await menuButton.click();
await expect(menuButton).toHaveAttribute("aria-expanded", "true");
await expect(sidebarSearchInput).not.toBeFocused();
});