The best way to control Claude Code, Codex and more from any computer or phone
fix(web): a new side chat focuses its message input (#32929)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Dario Ielardi committed
Nov 10, 2026 at 00:54 UTC
b10cdded50851ead0be729a5cedfff125dde7ca8
2 files changed
+29
-7
apps/web/src/lib/workspaceFocus.browser.test.ts
+21
@@ -259,6 +259,27 @@ describe("workspace area focus", () => {
259
expect(document.activeElement).toBe(clickedRow);
260
});
261
262
+ it("focuses a side chat's message input when the panel opens on it", () => {
263
+ using fixture = setup();
264
+ const panel = fixture.area("panel", 3);
265
+ const content = document.createElement("div");
266
+ content.setAttribute("data-right-panel-surface-content", "");
267
+ const bringBack = document.createElement("button");
268
+ bringBack.textContent = "Bring back";
269
+ content.append(bringBack);
270
+ panel.element.append(content);
271
+ fixture.area("conversation", 1, content);
272
+ const composer = fixture.area("composer", 2, content);
273
+ const editor = document.createElement("div");
274
+ editor.contentEditable = "true";
275
+ composer.element.append(editor);
276
+ expect(fixture.controller.focus("panel")).toBe(true);
277
+ expect(document.activeElement).toBe(editor);
278
+ // F6 from the message input moves on to the panel's own controls.
279
+ expect(fixture.controller.move(1)).toBe(true);
280
+ expect(document.activeElement).toBe(bringBack);
281
+ });
282
+
283
it("waits for a requested area to mount", async () => {
284
using fixture = setup();
285
fixture.area("composer", 2);
apps/web/src/lib/workspaceFocus.ts
+8
-7
@@ -123,18 +123,19 @@ export function createWorkspaceFocusController(doc: Document) {
123
};
124
doc.addEventListener("focusin", remember);
125
126
- const focusArea = (area: HTMLElement, restore = true) => {
126
+ const focusArea = (area: HTMLElement, restore = true, nested = true) => {
127
const key = area.dataset.workspaceFocusKey ?? area.dataset.workspaceArea!;
128
const previous = restore ? lastFocused.get(key) : undefined;
129
- const belongs = (element: HTMLElement) =>
130
- workspaceArea(element) === area &&
131
- isWorkspaceElementVisible(element) &&
132
- !element.matches(":disabled");
129
+ const usable = (element: HTMLElement) =>
130
+ isWorkspaceElementVisible(element) && !element.matches(":disabled");
131
+ const belongs = (element: HTMLElement) => workspaceArea(element) === area && usable(element);
132
+ // A side chat's message input sits in its own area inside the panel. Opening the
133
+ // panel focuses it, but F6 visits that area on its own, so it moves past it here.
134
const preferred = Array.from(
135
area.querySelectorAll<HTMLElement>(
136
'[data-workspace-focus-default], [data-sidebar-row][aria-current="page"], [data-settings-section][tabindex="0"], .xterm-helper-textarea, [contenteditable="true"]',
137
),
137
- ).find(belongs);
138
+ ).find(nested ? usable : belongs);
139
const fallback = Array.from(area.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)).find(
140
(element) => element.tabIndex >= 0 && belongs(element),
141
);
@@ -257,7 +258,7 @@ export function createWorkspaceFocusController(doc: Document) {
258
: areas.length - 1
259
: (current + direction + areas.length) % areas.length;
260
const area = areas[index]!;
260
- return focusArea(area);
261
+ return focusArea(area, true, false);
262
};
263
264
// Focus that drops to the body because its element was hidden, made inert, disabled, or removed