Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
fix(web): hide mobile category action hit targets (#1124)
Gener0e6ecce44fbf
diff --git a/src/web/src/components/community/channels/sortable-category.tsx b/src/web/src/components/community/channels/sortable-category.tsxindex eb648d099..f9f4b9383 100644--- a/src/web/src/components/community/channels/sortable-category.tsx+++ b/src/web/src/components/community/channels/sortable-category.tsx@@ -62,7 +62,7 @@ export function SortableCategory({ id: catDndId, name, open, onToggle, onAddChanonTouchStart={(e) => e.stopPropagation()}onDragStart={(e) => { e.preventDefault(); e.stopPropagation() }}onClick={(e) => { e.stopPropagation(); onSettings() }}- className="grid size-4 place-items-center rounded opacity-0 hover:bg-accent group-hover:opacity-100"+ className="hidden size-4 place-items-center rounded hover:bg-accent sm:grid sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100"aria-label={`Category settings for ${name}`}><Settings className="size-3" />@@ -74,7 +74,7 @@ export function SortableCategory({ id: catDndId, name, open, onToggle, onAddChanonTouchStart={(e) => e.stopPropagation()}onDragStart={(e) => { e.preventDefault(); e.stopPropagation() }}onClick={(e) => { e.stopPropagation(); onAddChannel() }}- className="grid size-4 place-items-center rounded opacity-0 hover:bg-accent group-hover:opacity-100"+ className="hidden size-4 place-items-center rounded hover:bg-accent sm:grid sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100"aria-label={`Create channel in ${name}`}><Plus className="size-3" />diff --git a/src/web/src/test/e2e-ui/02-server-channel-message.spec.ts b/src/web/src/test/e2e-ui/02-server-channel-message.spec.tsindex 13d8d7821..19966a68a 100644--- a/src/web/src/test/e2e-ui/02-server-channel-message.spec.ts+++ b/src/web/src/test/e2e-ui/02-server-channel-message.spec.ts@@ -1,9 +1,141 @@import { currentCommunityFixtureError } from "./_fixtures/business-contract"-import type { Request } from "@playwright/test"+import type { Locator, Page, Request } from "@playwright/test"import { test, expect } from "./_fixtures/case-fixture"import { tid } from "./_fixtures/testids"import { composerEditable, createServer, sendMessage, expectMessageVisible } from "./_fixtures/actions"+async function tabTo(page: Page, target: Locator) {+ for (let step = 0; step < 40; step++) {+ await page.keyboard.press("Tab")+ if (await target.evaluate(element => document.activeElement === element)) return+ }+ await expect(target).toBeFocused()+}++async function openTouchCategoryMenu(page: Page, header: Locator) {+ await header.scrollIntoViewIfNeeded()+ const box = await header.boundingBox()+ if (!box) throw new Error("category title is outside the viewport")+ const session = await page.context().newCDPSession(page)+ let started = false+ try {+ await session.send("Input.dispatchTouchEvent", {+ type: "touchStart",+ touchPoints: [{ x: box.x + box.width / 2, y: box.y + box.height / 2, radiusX: 1, radiusY: 1, force: 1, id: 2 }],+ })+ started = true+ await expect(page.getByRole("menu")).toBeVisible()+ } finally {+ try {+ if (started) await session.send("Input.dispatchTouchEvent", { type: "touchEnd", touchPoints: [] })+ } finally { await session.detach() }+ }+}++test("mobile category actions stay hidden while title menus and desktop keyboard actions work", async ({ caseActors }, testInfo) => {+ test.setTimeout(120_000)+ const actors = await caseActors(["alice", "bob"])+ const serverId = await actors.seed.seedServer("alice", `Category actions ${Date.now()}`)+ const categoryName = "CATEGORY ACTIONS"+ const categoryId = await actors.seed.seedCategory("alice", serverId, categoryName)+ const channelId = await actors.seed.seedChannel("alice", serverId, "category-actions", "text", categoryId)+ await actors.seed.seedJoinServer("alice", "bob", serverId)+ const settingsLabel = `Category settings for ${categoryName}`+ const createLabel = `Create channel in ${categoryName}`+ const mutations: string[] = []+ const observe = (request: Request) => {+ const path = new URL(request.url()).pathname+ if (request.method() !== "GET" && /\/(?:categories(?:\/[^/]+)?|channels(?:\/[^/]+)?|(?:category|channel)-order)$/.test(path)) mutations.push(`${request.method()} ${path}`)+ }+ const { page } = await actors.asUser("alice", { viewport: { width: 1280, height: 900 }, hasTouch: false, reducedMotion: "reduce" })+ page.on("request", observe)+ for (const width of [640, 1280]) {+ await page.setViewportSize({ width, height: 900 })+ await page.mouse.move(0, 0)+ await page.goto(`/c/channels/${serverId}/${channelId}`)+ const header = page.getByTestId(tid.categoryHeader(categoryId))+ await expect(header).toBeVisible()+ await expect(header).toHaveAttribute("aria-expanded", "true")+ const settings = header.getByRole("button", { name: settingsLabel, exact: true })+ const create = header.getByRole("button", { name: createLabel, exact: true })+ for (const button of [settings, create]) {+ await expect(button).toHaveCSS("display", "grid")+ await expect(button).toHaveCSS("opacity", "0")+ }+ await testInfo.attach(`category-actions-${width}-mouse-default.png`, { body: await page.screenshot(), contentType: "image/png" })+ await header.hover()+ for (const button of [settings, create]) await expect(button).toHaveCSS("opacity", "1")+ await page.mouse.move(0, 0)+ for (const button of [settings, create]) await expect(button).toHaveCSS("opacity", "0")+ for (const action of ["settings", "create"] as const) {+ await tabTo(page, header)+ await page.keyboard.press("Tab")+ if (action === "create") await page.keyboard.press("Tab")+ const button = action === "settings" ? settings : create+ await expect(button).toBeFocused()+ await expect(button).toHaveCSS("opacity", "1")+ await page.keyboard.press("Enter")+ const dialog = page.getByRole("dialog", { name: action === "settings" ? "Category settings" : `New channel in ${categoryName}`, exact: true })+ await expect(dialog).toBeVisible()+ await expect(header).toHaveAttribute("aria-expanded", "true")+ await expect(header).not.toHaveAttribute("data-dragging", "true")+ await dialog.getByRole("button", { name: "Cancel", exact: true }).click()+ await expect(dialog).toHaveCount(0)+ await expect(page.getByTestId(tid.channelRow(channelId))).toBeVisible()+ }+ }+ const { page: touch } = await actors.asUser("alice", { viewport: { width: 390, height: 844 }, hasTouch: true, isMobile: true, reducedMotion: "reduce" })+ touch.on("request", observe)+ for (const width of [390, 639]) {+ await touch.setViewportSize({ width, height: 844 })+ await touch.goto(`/c/channels/${serverId}`)+ const header = touch.getByTestId(tid.categoryHeader(categoryId))+ const row = touch.getByTestId(tid.channelRow(channelId))+ await expect(header).toBeVisible()+ await expect(header).toHaveAttribute("aria-expanded", "true")+ const buttons = [settingsLabel, createLabel].map(name => header.getByRole("button", { name, exact: true, includeHidden: true }))+ for (const button of buttons) {+ await expect(button).toHaveCount(1)+ await expect(button).toHaveCSS("display", "none")+ expect(await button.boundingBox()).toBeNull()+ }+ for (const name of [settingsLabel, createLabel]) await expect(header.getByRole("button", { name, exact: true })).toHaveCount(0)+ await testInfo.attach(`category-actions-${width}-touch-default.png`, { body: await touch.screenshot(), contentType: "image/png" })+ await tabTo(touch, header)+ for (const button of buttons) await expect(button).toHaveCSS("display", "none")+ await touch.keyboard.press("Tab")+ await expect(row).toBeFocused()+ for (const action of ["settings", "create"] as const) {+ await openTouchCategoryMenu(touch, header)+ await touch.getByRole("menuitem", { name: action === "settings" ? "Category settings" : "Create channel", exact: true }).tap()+ const dialog = touch.getByRole("dialog", { name: action === "settings" ? "Category settings" : `New channel in ${categoryName}`, exact: true })+ await expect(dialog).toBeVisible()+ await expect(header).toHaveAttribute("aria-expanded", "true")+ await expect(header).not.toHaveAttribute("data-dragging", "true")+ await dialog.getByRole("button", { name: "Cancel", exact: true }).tap()+ await expect(dialog).toHaveCount(0)+ await expect(row).toBeVisible()+ }+ await header.tap()+ await expect(header).toHaveAttribute("aria-expanded", "false")+ await expect(row).toHaveCount(0)+ await header.tap()+ await expect(header).toHaveAttribute("aria-expanded", "true")+ await expect(row).toBeVisible()+ }+ const { page: member } = await actors.asUser("bob", { viewport: { width: 390, height: 844 }, hasTouch: true, isMobile: true })+ member.on("request", observe)+ await member.goto(`/c/channels/${serverId}`)+ const memberHeader = member.getByTestId(tid.categoryHeader(categoryId))+ await expect(memberHeader).toBeVisible()+ for (const name of [settingsLabel, createLabel]) await expect(memberHeader.getByRole("button", { name, exact: true, includeHidden: true })).toHaveCount(0)+ expect(mutations).toEqual([])+ await testInfo.attach("category-actions-input.json", { body: JSON.stringify({ serverId, categoryId, channelId,+ contexts: [{ widths: [640, 1280], hasTouch: false, input: "mouse hover and native Tab/Enter" },+ { widths: [390, 639], hasTouch: true, isMobile: true, input: "stationary CDP touch hold, menu tap, native Tab and title tap" }],+ mutations }), contentType: "application/json" })+})+test("server → channel → message", async ({ caseActors, caseResources }) => {test.setTimeout(120_000)