Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(squads): correct custom picker trigger semantics (#10068)
YYClaw282f48eed253
diff --git a/packages/views/modals/create-squad.test.tsx b/packages/views/modals/create-squad.test.tsxindex 1b8d75db31..4780563cbb 100644--- a/packages/views/modals/create-squad.test.tsx+++ b/packages/views/modals/create-squad.test.tsx@@ -113,31 +113,9 @@ vi.mock("../agents/components/char-counter", () => ({),}));-// Render Popover/PopoverContent inline so the picker rows are queryable-// without simulating a Base UI portal — we still drive the open prop via-// PopoverTrigger clicks but the content is always in the DOM.-vi.mock("@multica/ui/components/ui/popover", () => ({- Popover: ({ children }: { children: ReactNode }) => <div>{children}</div>,- PopoverTrigger: ({- children,- className,- onClick,- render,- }: {- children?: ReactNode;- className?: string;- onClick?: () => void;- render?: ReactNode;- }) => {- // Base UI's `render` prop replaces the trigger with the provided element.- // The mock just renders it as-is so its children stay queryable in tests.- if (render !== undefined) return <>{render}</>;- return (- <button type="button" className={className} onClick={onClick}>- {children}- </button>- );- },+// Keep picker rows inline while exercising the real Base UI trigger semantics.+vi.mock("@multica/ui/components/ui/popover", async (importOriginal) => ({+ ...(await importOriginal<typeof import("@multica/ui/components/ui/popover")>()),PopoverContent: ({ children }: { children: ReactNode }) => <div>{children}</div>,}));@@ -295,6 +273,37 @@ describe("CreateSquadModal", () => {mocks.members = [wsMember];});+ it("supports the non-native members trigger without button warnings", () => {+ const consoleError = vi.spyOn(console, "error").mockImplementation(() => {});+ try {+ renderModal();+ expect(+ consoleError.mock.calls.filter((args) =>+ args.some((arg) => String(arg).includes("expected a native <button>")),+ ),+ ).toEqual([]);+ const trigger = screen.getByRole("combobox");+ expect(trigger.tagName).toBe("DIV");+ expect(trigger.getAttribute("aria-expanded")).toBe("false");++ fireEvent.keyDown(trigger, { key: "Enter", code: "Enter" });+ expect(trigger.getAttribute("aria-expanded")).toBe("true");+ fireEvent.keyDown(trigger, { key: " ", code: "Space" });+ fireEvent.keyUp(trigger, { key: " ", code: "Space" });+ expect(trigger.getAttribute("aria-expanded")).toBe("false");++ fireEvent.click(trigger);+ expect(trigger.getAttribute("aria-expanded")).toBe("true");+ fireEvent.click(lastMatch("MineAgentTwo"));+ const expandedBeforeRemoval = trigger.getAttribute("aria-expanded");+ fireEvent.click(screen.getByRole("button", { name: "Remove MineAgentTwo" }));+ expect(screen.queryByRole("button", { name: "Remove MineAgentTwo" })).toBeNull();+ expect(trigger.getAttribute("aria-expanded")).toBe(expandedBeforeRemoval);+ } finally {+ consoleError.mockRestore();+ }+ });+it("binds the name and description inputs in the identity row", () => {renderModal();const name = screen.getByPlaceholderText(/e\.g\. Frontend Team/i) as HTMLInputElement;diff --git a/packages/views/modals/create-squad.tsx b/packages/views/modals/create-squad.tsxindex 132bf50b40..a5378b1479 100644--- a/packages/views/modals/create-squad.tsx+++ b/packages/views/modals/create-squad.tsx@@ -471,6 +471,7 @@ function AdditionalMembersPicker({nesting interactive content. Base UI injects click/keyboard/ARIAwiring into the rendered element. */}<PopoverTrigger+ nativeButton={false}render={<divrole="combobox"