Skip to content

Commit 1d19fb4

Browse files
committed
Tighten sidebar accessibility and menu targets
1 parent 1e9ec57 commit 1d19fb4

3 files changed

Lines changed: 45 additions & 19 deletions

File tree

‎apps/web/src/app.css‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,13 +1677,9 @@ select:disabled,
16771677
opacity: 1;
16781678
}
16791679

1680-
.shell-ch-row-menu .chat-sidebar-row-menu-trigger::after {
1681-
inset: 0;
1682-
}
1683-
1684-
.shell-ch-row-wrap:hover .shell-ch-right,
1685-
.shell-ch-row-wrap:focus-within .shell-ch-right,
1686-
.shell-ch-row-wrap:has([aria-expanded="true"]) .shell-ch-right {
1680+
.shell-ch-row-wrap:hover .shell-ch-time,
1681+
.shell-ch-row-wrap:focus-within .shell-ch-time,
1682+
.shell-ch-row-wrap:has([aria-expanded="true"]) .shell-ch-time {
16871683
visibility: hidden;
16881684
}
16891685

‎apps/web/src/shell/workbench-list.tsx‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,12 @@ function WorkbenchRow({
307307
displayWorkbenchTitle(title, workbench.id) || CHAT_STRINGS.unnamedWorkbench;
308308
const { sharedLabel, live, time, unread } = signals;
309309
const hasUnread = typeof unread === "number" && unread > 0;
310+
const liveLabel =
311+
live === "working"
312+
? "Agent working"
313+
: live === "reply-ready"
314+
? "Reply ready"
315+
: "";
310316

311317
return (
312318
<div
@@ -325,7 +331,9 @@ function WorkbenchRow({
325331
>
326332
<span className="shell-ch-avatar" data-live={live}>
327333
{workbench.kind === "chat" ? (
328-
<CorbitAvatar size="sm" ariaLabel={displayTitle} />
334+
<span aria-hidden="true">
335+
<CorbitAvatar size="sm" ariaLabel={displayTitle} />
336+
</span>
329337
) : (
330338
<span className="shell-ch-initial" aria-hidden="true">
331339
{displayTitle.slice(0, 1).toUpperCase()}
@@ -334,20 +342,21 @@ function WorkbenchRow({
334342
{live === "working" ? (
335343
<span
336344
className="shell-ch-orbit"
337-
role="img"
338-
aria-label="Agent working"
345+
aria-hidden="true"
339346
title="Agent working"
340347
/>
341348
) : live === "reply-ready" ? (
342349
<span
343350
className="shell-ch-completion"
344-
role="img"
345-
aria-label="Reply ready"
351+
aria-hidden="true"
346352
title="Reply ready"
347353
>
348354
<Check aria-hidden="true" />
349355
</span>
350356
) : null}
357+
<span className="sr-only" aria-live="polite" aria-atomic="true">
358+
{liveLabel}
359+
</span>
351360
</span>
352361
<span className="shell-ch-meta">
353362
<span className="shell-ch-name-row">
@@ -373,7 +382,9 @@ function WorkbenchRow({
373382
<span className="shell-ch-time">{time}</span>
374383
) : null}
375384
{hasUnread && live !== "reply-ready" ? (
376-
<Badge tone="accent">{unread}</Badge>
385+
<Badge tone="accent" className="shell-ch-unread-badge">
386+
{unread}
387+
</Badge>
377388
) : null}
378389
</span>
379390
</button>

‎apps/web/test/workbench-list.test.tsx‎

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,17 +230,36 @@ describe("WorkbenchList avatar activity", () => {
230230
});
231231
const el = await mount();
232232
const avatar = el.querySelector(".shell-ch-avatar");
233-
expect(avatar?.querySelector('[data-corbit="true"]')).not.toBeNull();
233+
const corbit = avatar?.querySelector('[data-corbit="true"]');
234+
expect(corbit).not.toBeNull();
235+
expect(corbit?.parentElement?.getAttribute("aria-hidden")).toBe("true");
234236
expect(el.querySelector(".shell-ch-preview")?.textContent).toBe(
235237
"Here is the revised draft.",
236238
);
237239
expect(el.querySelector(".shell-ch-live")).toBeNull();
238-
expect(
239-
avatar?.querySelector('[aria-label="Agent working"]') !== null,
240-
).toBe(activity === "working");
241-
expect(avatar?.querySelector('[aria-label="Reply ready"]') !== null).toBe(
242-
activity === "reply-ready",
240+
expect(avatar?.querySelector('[aria-live="polite"]')?.textContent).toBe(
241+
activity === "working"
242+
? "Agent working"
243+
: activity === "reply-ready"
244+
? "Reply ready"
245+
: "",
243246
);
247+
if (activity === "working") {
248+
expect(avatar?.querySelector(".shell-ch-orbit")).not.toBeNull();
249+
} else {
250+
expect(avatar?.querySelector(".shell-ch-orbit")).toBeNull();
251+
}
252+
if (activity === "reply-ready") {
253+
expect(avatar?.querySelector(".shell-ch-completion")).not.toBeNull();
254+
} else {
255+
expect(avatar?.querySelector(".shell-ch-completion")).toBeNull();
256+
}
257+
const unreadBadge = el.querySelector(".shell-ch-unread-badge");
258+
if (activity === "reply-ready") {
259+
expect(unreadBadge).toBeNull();
260+
} else {
261+
expect(unreadBadge?.textContent).toBe("1");
262+
}
244263
});
245264
}
246265
});

0 commit comments

Comments
 (0)