Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-8908: fix(issues): restore typing in filter submenus (#10249)
Jiayuan Zhang0085ab2d0d1e
diff --git a/packages/views/issues/components/issues-header.advanced-filter.test.tsx b/packages/views/issues/components/issues-header.advanced-filter.test.tsxindex 8ea77e2597..1696a65516 100644--- a/packages/views/issues/components/issues-header.advanced-filter.test.tsx+++ b/packages/views/issues/components/issues-header.advanced-filter.test.tsx@@ -37,10 +37,17 @@ function renderFilterMenu(setup?: (store: StoreApi<IssueViewState>) => void, witlistMembers: async () => [],listAgents: async () => [{ id: "agent-lambda", name: "Lambda", archived_at: null, owner_id: "u-1" },+ { id: "agent-eve", name: "Eve", archived_at: null, owner_id: "u-1" },],listSquads: async () => [],- listProjects: async () => ({ projects: [], total: 0 }),- listLabels: async () => ({ labels: [{ id: "label-bug", name: "Bug", color: "#f00" }], total: 1 }),+ listProjects: async () => ({ projects: [+ { id: "project-launch", title: "Launch Plan" },+ { id: "project-maintenance", title: "Maintenance" },+ ], total: 2 }),+ listLabels: async () => ({ labels: [+ { id: "label-bug", name: "Bug", color: "#f00" },+ { id: "label-feature", name: "Feature", color: "#00f" },+ ], total: 2 }),} as unknown as ApiClient);registerAuthStore(createAuthStore({@@ -68,6 +75,45 @@ afterEach(() => {});describe("IssueFilterMenu search", () => {+ it.each([+ { field: "Assignee", query: "Lam", match: "Lambda", other: "Eve", key: "assigneeFilters", value: { type: "agent", id: "agent-lambda" } },+ { field: "Creator", query: "Lam", match: "Lambda", other: "Eve", key: "creatorFilters", value: { type: "agent", id: "agent-lambda" } },+ { field: "Project", query: "Launch Pl", match: "Launch Plan", other: "Maintenance", key: "projectFilters", value: "project-launch" },+ { field: "Label", query: "Bu", match: "Bug", other: "Feature", key: "labelFilters", value: "label-bug" },+ ] as const)("keeps typed search and editing keys in the $field submenu", async ({ field, query, match, other, key, value }) => {+ const user = userEvent.setup();+ const store = renderFilterMenu();+ fireEvent.click(screen.getByRole("button", { name: "Filter" }));+ const trigger = await screen.findByRole("menuitem", { name: field });+ fireEvent.click(trigger);+ const search = await screen.findByPlaceholderText("Filter...");+ await screen.findByRole("menuitemcheckbox", { name: other });++ await user.type(search, query);+ expect(search).toHaveValue(query);+ expect(search).toHaveFocus();+ expect(screen.queryByRole("menuitemcheckbox", { name: other })).not.toBeInTheDocument();++ // Left/right edit the query instead of closing the submenu.+ await user.keyboard("{ArrowLeft}{ArrowRight}{Backspace}");+ expect(search).toHaveValue(query.slice(0, -1));+ expect(search).toHaveFocus();+ expect(store.getState()[key]).toEqual([]);++ await user.keyboard("{ArrowDown}");+ expect(screen.getByRole("menuitemradio", { name: "is not" })).toHaveFocus();+ await user.keyboard("{ArrowDown}");+ const option = screen.getByRole("menuitemcheckbox", { name: match });+ expect(option).toHaveFocus();+ await user.keyboard("{Enter}");+ expect(store.getState()[key]).toEqual([value]);++ await user.click(search);+ await user.keyboard("{Escape}");+ await waitFor(() => expect(screen.queryByPlaceholderText("Filter...")).not.toBeInTheDocument());+ expect(trigger).toHaveFocus();+ });+it("offers values as conditions and toggles them", async () => {const store = renderFilterMenu();fireEvent.click(screen.getByRole("button", { name: "Filter" }));diff --git a/packages/views/issues/components/issues-header.tsx b/packages/views/issues/components/issues-header.tsxindex 77b248de2e..d2d1de5a21 100644--- a/packages/views/issues/components/issues-header.tsx+++ b/packages/views/issues/components/issues-header.tsx@@ -396,6 +396,7 @@ export function ActorSubContent({type="text"value={search}onChange={(e) => setSearch(e.target.value)}+ onKeyDown={stopMenuSearchKeys}placeholder={t(($) => $.filters.placeholder)}className="w-full bg-transparent text-body placeholder:text-muted-foreground outline-none"autoFocus@@ -565,6 +566,7 @@ export function ProjectSubContent({type="text"value={search}onChange={(e) => setSearch(e.target.value)}+ onKeyDown={stopMenuSearchKeys}placeholder={t(($) => $.filters.placeholder)}className="w-full bg-transparent text-body placeholder:text-muted-foreground outline-none"autoFocus@@ -694,6 +696,7 @@ export function LabelSubContent({type="text"value={search}onChange={(e) => setSearch(e.target.value)}+ onKeyDown={stopMenuSearchKeys}placeholder={t(($) => $.filters.placeholder)}className="w-full bg-transparent text-body placeholder:text-muted-foreground outline-none"autoFocus