The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 23, 01:45 UTC
fix(web): keep expanded tool actions usable from the keyboard (#18831)
Co-authored-by: SAPHID <saphid@users.noreply.github.com> Co-authored-by: GPT-6.1 Sol <noreply@openai.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Alex Southwell committed
Oct 20, 2026 at 04:51 UTC
5a264a8b34351d93fae6ca09501ce651301c88c2
2 files changed
+37
-1
apps/web/src/components/chat/MessagesTimeline.browser.test.tsx
+36
@@ -194,6 +194,42 @@ async function click(element: HTMLElement) {
194
}
195
196
describe("MessagesTimeline work rows", () => {
197
+ it.each([
198
+ ["Enter", "{Enter}"],
199
+ ["Space", " "],
200
+ ])("opens a nested diff with %s without collapsing the tool row", async (_name, key) => {
201
+ const onOpenTurnDiff = vi.fn();
202
+ await renderTimeline(
203
+ [
204
+ work("file-change-1", {
205
+ label: "Updated src/index.ts",
206
+ tone: "tool",
207
+ itemType: "file_change",
208
+ toolLifecycleStatus: "completed",
209
+ projectedItem: v2Item("file_change", { id: "file-change-1", fileName: "src/index.ts" }),
210
+ }),
211
+ ],
212
+ { onOpenTurnDiff },
213
+ );
214
+ const row = container.querySelector<HTMLElement>('[data-v2-item-type="file_change"]')!;
215
+ const press = async (target: HTMLElement) => {
216
+ await act(async () => {
217
+ target.focus();
218
+ await userEvent.keyboard(key);
219
+ });
220
+ };
221
+ expect(row.getAttribute("aria-expanded")).toBe("false");
222
+ await press(row);
223
+ expect(row.getAttribute("aria-expanded")).toBe("true");
224
+ const openDiff = button("Open diff");
225
+ await press(openDiff);
226
+ expect(onOpenTurnDiff).toHaveBeenCalledWith("run-1", "src/index.ts");
227
+ expect(onOpenTurnDiff).toHaveBeenCalledTimes(1);
228
+ expect(row.getAttribute("aria-expanded")).toBe("true");
229
+ await press(row);
230
+ expect(row.getAttribute("aria-expanded")).toBe("false");
231
+ });
232
+
233
it("shows dynamic tool input without cached output when the row is expanded", async () => {
234
await renderTimeline([
235
work("tool-with-cached-output", {
apps/web/src/components/chat/MessagesTimeline.tsx
+1
-1
@@ -5439,7 +5439,7 @@ function WorkEntryLogRow(props: WorkEntryRowProps) {
5439
"aria-expanded": expanded,
5440
onClick: toggleExpanded,
5441
onKeyDown: (e: KeyboardEvent<HTMLDivElement>) => {
5442
- if (e.key === "Enter" || e.key === " ") {
5442
+ if (e.target === e.currentTarget && (e.key === "Enter" || e.key === " ")) {
5443
e.preventDefault();
5444
toggleExpanded();
5445
}