@devries-cameron20 / t3code Mirror · read-only / commits / 5b9731cedc
Fork 0

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 22, 07:00 UTC

fix(web): screen readers can browse and Tab through the threads sidebar again without going into focus mode (#26690)

Co-authored-by: nibarAhmed <nibarahmed0@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: shivam <91240327+shivamhwp@users.noreply.github.com>

nibarAhmed committed Nov 3, 2026 at 01:02 UTC 5b9731cedc06f310c394f48e66d50a614397c0aa
11 files changed +99 -209
apps/web/src/components/ChatView.logic.browser.test.ts
+10 -10
@@ -3,20 +3,20 @@ import { userEvent } from "vite-plus/test/browser";
3 import { shouldRefocusComposerOnWindowFocus } from "./ChatView.logic";
4
5 it("keeps keyboard focus on a sidebar row on window return, but not a clicked row", async () => {
6 - const tree = document.createElement("div");
7 - tree.setAttribute("role", "tree");
8 - const row = (name: string, tabIndex: number) => {
6 + const list = document.createElement("ul");
7 + const row = (name: string) => {
8 const element = document.createElement("div");
10 - element.setAttribute("role", "treeitem");
11 - element.tabIndex = tabIndex;
9 + element.setAttribute("role", "button");
10 + element.tabIndex = 0;
11 + element.dataset.sidebarRow = name;
12 element.textContent = name;
13 - tree.append(element);
13 + list.append(element);
14 return element;
15 };
16 - const clicked = row("Clicked thread", -1);
17 - const tabbed = row("Tabbed thread", 0);
18 - document.body.append(tree);
19 - using _tree = { [Symbol.dispose]: () => tree.remove() };
16 + const clicked = row("Clicked thread");
17 + const tabbed = row("Tabbed thread");
18 + document.body.append(list);
19 + using _list = { [Symbol.dispose]: () => list.remove() };
20
21 await userEvent.click(clicked);
22 expect(document.activeElement).toBe(clicked);
apps/web/src/components/ChatView.logic.ts
+1 -1
@@ -1166,7 +1166,7 @@ export function shouldRefocusComposerOnWindowFocus(
1166 }
1167 return (
1168 activeElement.closest(
1169 - '[data-workspace-area]:focus-visible, [role="treeitem"]:focus-visible, [role="dialog"], [role="alertdialog"], [role="application"], [role="menu"], [role="listbox"], [data-slot$="-popup"], [data-terminal-owner]',
1169 + '[data-workspace-area]:focus-visible, [data-sidebar-row]:focus-visible, [role="dialog"], [role="alertdialog"], [role="application"], [role="menu"], [role="listbox"], [data-slot$="-popup"], [data-terminal-owner]',
1170 ) === null
1171 );
1172 }
apps/web/src/components/Sidebar.tsx
+4 -4
@@ -1,5 +1,5 @@
1 import { liveShellEnvironmentIdsAtom } from "../state/shell";
2 -import { attachSidebarTree, SIDEBAR_TREE_PROPS } from "../lib/sidebarTree";
2 +import { attachSidebarTree } from "../lib/sidebarTree";
3 import { type EnvironmentId, type ScopedProjectRef } from "@t3tools/contracts";
4 import type { EnvironmentServerConfig } from "@t3tools/client-runtime/connection";
5 import { ThreadContextDragGhost } from "./chat/ThreadContextDragGhost";
@@ -3292,8 +3292,10 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
3292 >
3293 <SortableContext items={sortableIds} strategy={sidebarSortingStrategy}>
3294 <ul
3295 - {...SIDEBAR_TREE_PROPS}
3295 ref={attachTreeRef}
3296 + // Presentation flattens VoiceOver's list interaction boundary while preserving descendant
3297 + // controls.
3298 + role="presentation"
3299 className={cn(
3300 "relative flex flex-col gap-px",
3301 sidebarListItems.length > 0 && "flex-1",
@@ -3581,8 +3583,6 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
3583 <li className="list-none">
3584 <button
3585 type="button"
3584 - role="treeitem"
3585 - tabIndex={-1}
3586 data-sidebar-row="settled:more"
3587 data-sidebar-parent="shelf:settled"
3588 disabled={olderSettledShelf.loading}
apps/web/src/components/sidebar/SidebarDraftBlock.tsx
+2 -2
@@ -82,8 +82,8 @@ const SidebarDraftRow = memo(function SidebarDraftRow(props: {
82 return (
83 <li className="list-none py-0.5">
84 <div
85 - role="treeitem"
86 - tabIndex={-1}
85 + role="button"
86 + tabIndex={0}
87 data-sidebar-row={`draft:${draftId}`}
88 aria-label={accessibility.label}
89 aria-current={accessibility.current}
apps/web/src/components/sidebar/SidebarListMarkers.tsx
-2
@@ -130,8 +130,6 @@ export function SidebarSectionHeader(props: {
130 className={cn("relative mx-0.5 h-8", props.className)}
131 >
132 <CollapsibleSectionHeader
133 - role="treeitem"
134 - tabIndex={-1}
133 data-sidebar-row={`shelf:${shelf}`}
134 onClick={props.toggle.onToggle}
135 expanded={props.toggle.expanded}
apps/web/src/components/sidebar/SidebarProjectFolderHeader.tsx
-2
@@ -66,8 +66,6 @@ export const SidebarProjectFolderHeader = memo(function SidebarProjectFolderHead
66 >
67 <button
68 type="button"
69 - role="treeitem"
70 - tabIndex={-1}
69 data-sidebar-row={rowId}
70 aria-expanded={!collapsed}
71 onClick={() => props.onToggle(group)}
apps/web/src/components/sidebar/SidebarThreadRow.tsx
+4 -4
@@ -1208,8 +1208,8 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
1208 render={
1209 <div
1210 ref={rowRef}
1211 - role="treeitem"
1212 - tabIndex={-1}
1211 + role="button"
1212 + tabIndex={0}
1213 data-sidebar-row={threadKey}
1214 data-sidebar-parent={props.navigationParent}
1215 aria-label={accessibility.label}
@@ -1404,8 +1404,8 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
1404 render={
1405 <div
1406 ref={rowRef}
1407 - role="treeitem"
1408 - tabIndex={-1}
1407 + role="button"
1408 + tabIndex={0}
1409 data-sidebar-row={threadKey}
1410 data-sidebar-parent={props.navigationParent}
1411 aria-label={accessibility.label}
apps/web/src/lib/sidebarTree.browser.test.ts
+20 -46
@@ -4,14 +4,12 @@ import { installSidebarTree } from "./sidebarTree";
4
5 function setup() {
6 const root = document.createElement("div");
7 - root.setAttribute("role", "tree");
7 document.body.append(root);
8 let dispose: (() => void) | undefined;
9 const row = (id: string, parent?: string) => {
10 const element = document.createElement("button");
11 element.dataset.sidebarRow = id;
12 if (parent) element.dataset.sidebarParent = parent;
14 - element.setAttribute("role", "treeitem");
13 element.textContent = id;
14 root.append(element);
15 return element;
@@ -36,7 +34,7 @@ function press(target: HTMLElement, key: string, init: KeyboardEventInit = {}) {
34 }
35
36 describe("sidebar keyboard navigation", () => {
39 - it("moves focus without activating rows, clamps at the ends, and keeps one Tab stop", () => {
37 + it("moves focus without activating rows, clamps at the ends, and keeps every row in the Tab order", () => {
38 using tree = setup();
39 const first = tree.row("first");
40 const second = tree.row("second");
@@ -54,10 +52,10 @@ describe("sidebar keyboard navigation", () => {
52 press(last, "Home");
53 expect(document.activeElement).toBe(first);
54 expect(activate).not.toHaveBeenCalled();
57 - expect(tree.root.querySelectorAll('[tabindex="0"]')).toHaveLength(1);
55 + expect([first.tabIndex, second.tabIndex, last.tabIndex]).toEqual([0, 0, 0]);
56 });
57
60 - it("expands a group before entering its first child and returns to the parent", async () => {
58 + it("expands a group before entering its first child and returns to the parent", () => {
59 using tree = setup();
60 const group = tree.row("project");
61 group.setAttribute("aria-expanded", "false");
@@ -72,12 +70,6 @@ describe("sidebar keyboard navigation", () => {
70 press(group, "ArrowRight");
71 expect(group.getAttribute("aria-expanded")).toBe("true");
72 expect(document.activeElement).toBe(group);
75 - // The tree picks up the new child from its mutation observer.
76 - await vi.waitFor(() =>
77 - expect(
78 - tree.root.querySelector('[data-sidebar-parent="project"]')?.getAttribute("aria-level"),
79 - ).toBe("2"),
80 - );
73 press(group, "ArrowRight");
74 const child = document.activeElement as HTMLElement;
75 expect(child.dataset.sidebarRow).toBe("thread");
@@ -104,7 +96,7 @@ describe("sidebar keyboard navigation", () => {
96 expect(document.activeElement).toBe(selected);
97 });
98
107 - it("lets Tab reach only the focused row's buttons", () => {
99 + it("leaves every row's buttons in the Tab order", () => {
100 using tree = setup();
101 const first = tree.row("first");
102 const second = tree.row("second");
@@ -119,10 +111,10 @@ describe("sidebar keyboard navigation", () => {
111 const secondAction = action("second");
112 tree.install();
113 first.focus();
122 - expect([firstAction.tabIndex, secondAction.tabIndex]).toEqual([0, -1]);
114 + expect([firstAction.tabIndex, secondAction.tabIndex]).toEqual([0, 0]);
115 press(first, "ArrowDown");
116 expect(document.activeElement).toBe(second);
125 - expect([firstAction.tabIndex, secondAction.tabIndex]).toEqual([-1, 0]);
117 + expect([firstAction.tabIndex, secondAction.tabIndex]).toEqual([0, 0]);
118 });
119
120 it("keeps a rendered row under a collapsed group reachable", () => {
@@ -152,26 +144,6 @@ describe("sidebar keyboard navigation", () => {
144 expect(undo.tabIndex).toBe(0);
145 });
146
155 - it("gives row buttons back their own tab order when the tree reinstalls", () => {
156 - using tree = setup();
157 - tree.row("first");
158 - const second = tree.row("second");
159 - const action = (owner: string) => {
160 - const button = document.createElement("button");
161 - button.dataset.sidebarActionFor = owner;
162 - tree.root.append(button);
163 - return button;
164 - };
165 - const firstAction = action("first");
166 - const secondAction = action("second");
167 - const dispose = installSidebarTree(tree.root);
168 - second.focus();
169 - dispose();
170 - expect([firstAction.tabIndex, secondAction.tabIndex]).toEqual([0, 0]);
171 - tree.install();
172 - expect([firstAction.tabIndex, secondAction.tabIndex]).toEqual([-1, 0]);
173 - });
174 -
147 it("keeps the scroll position when focus follows a row that moved away", async () => {
148 using tree = setup();
149 Object.assign(tree.root.style, { height: "100px", overflow: "auto" });
@@ -191,7 +163,7 @@ describe("sidebar keyboard navigation", () => {
163 expect(tree.root.scrollTop).toBe(0);
164 });
165
194 - it("does not pull focus back after a click outside the tree", async () => {
166 + it("does not pull focus back after a click outside the rows", async () => {
167 using tree = setup();
168 const first = tree.row("first");
169 tree.install();
@@ -199,16 +171,18 @@ describe("sidebar keyboard navigation", () => {
171 text.textContent = "Chat text";
172 document.body.append(text);
173 using _text = { [Symbol.dispose]: () => text.remove() };
202 - first.focus();
203 - await userEvent.click(text);
204 - expect(document.activeElement).toBe(document.body);
205 - // A status change re-renders the tree while the user works elsewhere.
206 - tree.row("second");
207 - await vi.waitFor(() =>
208 - expect(
209 - tree.root.querySelector('[data-sidebar-row="second"]')?.getAttribute("aria-posinset"),
210 - ).toBe("2"),
211 - );
212 - expect(document.activeElement).toBe(document.body);
174 + const spacer = document.createElement("div");
175 + spacer.textContent = "Empty list space";
176 + tree.root.append(spacer);
177 + for (const target of [text, spacer]) {
178 + first.focus();
179 + await userEvent.click(target);
180 + expect(document.activeElement).toBe(document.body);
181 + // A status change re-renders the list while the user works elsewhere.
182 + tree.row(`second-${target.tagName}`);
183 + // The list's mutation observer callback is queued ahead of this continuation.
184 + await Promise.resolve();
185 + expect(document.activeElement).toBe(document.body);
186 + }
187 });
188 });
apps/web/src/lib/sidebarTree.ts
+54 -134
@@ -1,139 +1,82 @@
1 const ROW = "[data-sidebar-row]";
2 -const CONTROL = 'button, a[href], input, textarea, select, [contenteditable="true"], [tabindex]';
3 -const TEXT_ENTRY = 'input, textarea, select, [contenteditable="true"]';
2
5 -function setAttribute(element: Element, name: string, value: string) {
6 - if (element.getAttribute(name) !== value) element.setAttribute(name, value);
7 -}
8 -
9 -function setTabIndex(element: HTMLElement, value: number) {
10 - if (element.tabIndex !== value) element.tabIndex = value;
11 -}
12 -
13 -export const SIDEBAR_TREE_PROPS = { role: "tree", "aria-label": "Threads" } as const;
14 -
15 -/** Ref callback for a sidebar list; installs the tree and returns its cleanup. */
3 +/** Ref callback for a sidebar list; installs its keyboard navigation and returns its cleanup. */
4 export function attachSidebarTree(element: HTMLElement | null) {
5 return element ? installSidebarTree(element) : undefined;
6 }
7
20 -/** A roving DOM focus, separate from thread activation, as in VS Code's list commands. */
8 +/**
9 + * Arrow keys move focus between rows without opening them, as in VS Code's list commands.
10 + * Rows stay ordinary buttons in the Tab order so screen readers can browse the list.
11 + */
12 export function installSidebarTree(root: HTMLElement) {
22 - let rows: HTMLElement[] = [];
13 let focusedId: string | undefined;
14 + let focusedParent: string | undefined;
15 + let focusedIndex = -1;
16 let ownsFocus = false;
25 - let tabStop: HTMLElement | undefined;
17 let contextMenuRow: HTMLElement | undefined;
27 - // A control's own tab index, restored while its row holds the Tab stop and on uninstall.
28 - const ownTabIndex = new Map<HTMLElement, number>();
18
30 - const rowControls = (row: HTMLElement) => {
31 - const id = row.dataset.sidebarRow;
32 - const linked = id
33 - ? root.querySelectorAll<HTMLElement>(`[data-sidebar-action-for="${CSS.escape(id)}"]`)
34 - : [];
35 - return [...row.querySelectorAll<HTMLElement>(CONTROL), ...linked].filter(
36 - (control) => !control.matches(ROW) && !control.matches(TEXT_ENTRY),
37 - );
38 - };
39 - // Tab reaches the buttons of the focused row only, so the tree stays one stop for the rest.
40 - const setRowControlsReachable = (row: HTMLElement, reachable: boolean) => {
41 - for (const control of rowControls(row)) {
42 - if (!ownTabIndex.has(control)) ownTabIndex.set(control, control.tabIndex);
43 - setTabIndex(control, reachable ? ownTabIndex.get(control)! : -1);
44 - }
19 + const isVisibleRow = (row: HTMLElement) => {
20 + const hidden = row.closest('[hidden], [inert], [aria-hidden="true"]');
21 + // A dialog can temporarily make the whole workspace inert. Keep rows navigable
22 + // for its return while still excluding exiting row clones.
23 + return (!hidden || !root.contains(hidden)) && !row.matches(":disabled");
24 };
25 + const visibleRows = () =>
26 + Array.from(root.querySelectorAll<HTMLElement>(ROW)).filter(isVisibleRow);
27
47 - const setTabStop = (row: HTMLElement) => {
48 - if (tabStop === row) return;
49 - if (tabStop) {
50 - setTabIndex(tabStop, -1);
51 - setRowControlsReachable(tabStop, false);
52 - }
53 - setTabIndex(row, 0);
54 - setRowControlsReachable(row, true);
55 - tabStop = row;
56 - focusedId = row.dataset.sidebarRow;
28 + const ownerRow = (element: HTMLElement) => {
29 + const row = element.closest<HTMLElement>(ROW);
30 + if (row) return row;
31 + const linked = element.dataset.sidebarActionFor;
32 + return linked
33 + ? root.querySelector<HTMLElement>(`[data-sidebar-row="${CSS.escape(linked)}"]`)
34 + : null;
35 };
36
37 const focusRow = (row: HTMLElement) => {
60 - setTabStop(row);
38 // Revealing before focusing also materializes content-visibility:auto descendants.
39 row.scrollIntoView({ block: "nearest" });
40 row.focus({ preventScroll: true });
41 };
42
66 - const refresh = () => {
67 - const previousRows = rows;
68 - const previousIndex = previousRows.findIndex((row) => row.dataset.sidebarRow === focusedId);
69 - const previous = previousRows[previousIndex];
70 - rows = Array.from(root.querySelectorAll<HTMLElement>(ROW)).filter((row) => {
71 - const hidden = row.closest('[hidden], [inert], [aria-hidden="true"]');
72 - // A dialog can temporarily make the whole workspace inert. Keep the tree's
73 - // Tab stop ready for its return while still excluding exiting row clones.
74 - return (!hidden || !root.contains(hidden)) && !row.matches(":disabled");
75 - });
76 - let selected =
43 + // A row that moves shelves remounts and drops focus to the body; follow it.
44 + const restoreFocus = () => {
45 + if (!ownsFocus || focusedId === undefined) return;
46 + const active = document.activeElement;
47 + const lost =
48 + active === document.body ||
49 + (active instanceof HTMLElement &&
50 + root.contains(active) &&
51 + active.matches(ROW) &&
52 + !isVisibleRow(active));
53 + if (!lost) return;
54 + const rows = visibleRows();
55 + const target =
56 rows.find((row) => row.dataset.sidebarRow === focusedId) ??
78 - rows.find((row) => row === document.activeElement);
79 - if (!selected) {
80 - selected =
81 - rows.find((row) => row.dataset.sidebarRow === previous?.dataset.sidebarParent) ??
82 - (previousIndex === -1 ? rows.find((row) => row.hasAttribute("aria-current")) : undefined) ??
83 - rows[Math.min(Math.max(previousIndex, 0), rows.length - 1)];
84 - }
85 - focusedId = selected?.dataset.sidebarRow;
86 - tabStop = selected;
87 - setTabIndex(root, selected ? -1 : 0);
88 - const siblings = new Map<string, HTMLElement[]>();
89 - for (const row of rows) {
90 - const parent = row.dataset.sidebarParent ?? "";
91 - const group = siblings.get(parent) ?? [];
92 - group.push(row);
93 - siblings.set(parent, group);
94 - setAttribute(row, "aria-level", parent ? "2" : "1");
95 - setTabIndex(row, row === selected ? 0 : -1);
96 - }
97 - const byId = new Map(rows.map((row) => [row.dataset.sidebarRow, row]));
98 - for (const control of ownTabIndex.keys()) if (!control.isConnected) ownTabIndex.delete(control);
99 - for (const control of root.querySelectorAll<HTMLElement>(CONTROL)) {
100 - if (control.matches(ROW) || control.matches(TEXT_ENTRY)) continue;
101 - const linked = control.dataset.sidebarActionFor;
102 - const owner = control.closest<HTMLElement>(ROW) ?? (linked ? byId.get(linked) : undefined);
103 - if (!owner) continue;
104 - if (!ownTabIndex.has(control)) ownTabIndex.set(control, control.tabIndex);
105 - setTabIndex(control, owner === selected ? ownTabIndex.get(control)! : -1);
106 - }
107 - for (const group of siblings.values())
108 - group.forEach((row, index) => {
109 - setAttribute(row, "aria-posinset", String(index + 1));
110 - setAttribute(row, "aria-setsize", String(group.length));
111 - });
112 - for (const listItem of root.querySelectorAll("li:not([role])"))
113 - listItem.setAttribute("role", "presentation");
114 - if (
115 - ownsFocus &&
116 - selected &&
117 - (document.activeElement === document.body ||
118 - document.activeElement === root ||
119 - (root.contains(document.activeElement) &&
120 - !rows.includes(document.activeElement as HTMLElement) &&
121 - document.activeElement?.matches(ROW)))
122 - ) {
123 - // A settled row moves to the bottom shelf; scrolling after it fights the route reveal.
124 - selected.focus({ preventScroll: true });
125 - }
126 - if (ownsFocus && !selected && document.activeElement === document.body) root.focus();
57 + rows.find((row) => row.dataset.sidebarRow === focusedParent) ??
58 + rows[Math.min(Math.max(focusedIndex, 0), rows.length - 1)];
59 + // A settled row moves to the bottom shelf; scrolling after it fights the route reveal.
60 + target?.focus({ preventScroll: true });
61 };
62
129 - // Clicking non-focusable content drops focus to the body without a focusin event.
63 + // Clicking non-focusable content, including empty list space, drops focus to the body
64 + // without a focusin event. A click on the focused row fires no focusin either.
65 const onPointerDown = (event: PointerEvent) => {
131 - if (!root.contains(event.target as Node)) ownsFocus = false;
66 + const focusable =
67 + event.target instanceof Element
68 + ? event.target.closest(`${ROW}, button, a[href], input, [tabindex]`)
69 + : null;
70 + ownsFocus = focusable !== null && root.contains(focusable);
71 };
72 const onFocus = (event: FocusEvent) => {
73 ownsFocus = root.contains(event.target as Node);
135 - if (!ownsFocus || !(event.target instanceof HTMLElement) || !event.target.matches(ROW)) return;
136 - setTabStop(event.target);
74 + if (!ownsFocus || !(event.target instanceof HTMLElement)) return;
75 + const row = ownerRow(event.target);
76 + if (!row) return;
77 + focusedId = row.dataset.sidebarRow;
78 + focusedParent = row.dataset.sidebarParent;
79 + focusedIndex = visibleRows().indexOf(row);
80 };
81 const onKeyDown = (event: KeyboardEvent) => {
82 const row = event.target;
@@ -162,6 +105,7 @@ export function installSidebarTree(root: HTMLElement) {
105 )
106 return;
107 if (!(row instanceof HTMLElement) || !row.matches(ROW)) return;
108 + const rows = visibleRows();
109 const index = rows.indexOf(row);
110 if (index < 0) return;
111 let target: HTMLElement | undefined;
@@ -219,34 +163,12 @@ export function installSidebarTree(root: HTMLElement) {
163 }),
164 );
165 };
222 - refresh();
223 - const observer = new MutationObserver((records) => {
224 - if (
225 - records.some(
226 - (record) =>
227 - record.type === "attributes" ||
228 - [...record.addedNodes, ...record.removedNodes].some(
229 - (node) =>
230 - node instanceof Element &&
231 - (node.matches(`${ROW}, ${CONTROL}`) || node.querySelector(`${ROW}, ${CONTROL}`)),
232 - ),
233 - )
234 - )
235 - refresh();
236 - });
166 + const observer = new MutationObserver(restoreFocus);
167 observer.observe(root, {
168 childList: true,
169 subtree: true,
170 attributes: true,
241 - attributeFilter: [
242 - "data-sidebar-row",
243 - "data-sidebar-parent",
244 - "aria-expanded",
245 - "hidden",
246 - "disabled",
247 - "inert",
248 - "aria-hidden",
249 - ],
171 + attributeFilter: ["hidden", "inert", "aria-hidden"],
172 });
173 document.addEventListener("focusin", onFocus);
174 document.addEventListener("pointerdown", onPointerDown, true);
@@ -254,8 +176,6 @@ export function installSidebarTree(root: HTMLElement) {
176 root.addEventListener("keyup", onKeyUp, true);
177 return () => {
178 observer.disconnect();
257 - // A later install reads these as the controls' own tab indexes.
258 - for (const [control, tabIndex] of ownTabIndex) setTabIndex(control, tabIndex);
179 document.removeEventListener("focusin", onFocus);
180 document.removeEventListener("pointerdown", onPointerDown, true);
181 root.removeEventListener("keydown", onKeyDown, true);
apps/web/src/lib/workspaceFocus.ts
+1 -1
@@ -114,7 +114,7 @@ export function createWorkspaceFocusController(doc: Document) {
114 !element.matches(":disabled");
115 const preferred = Array.from(
116 area.querySelectorAll<HTMLElement>(
117 - '[data-workspace-focus-default], [role="treeitem"][tabindex="0"], [data-settings-section][tabindex="0"], .xterm-helper-textarea, [contenteditable="true"]',
117 + '[data-workspace-focus-default], [data-sidebar-row][aria-current="page"], [data-settings-section][tabindex="0"], .xterm-helper-textarea, [contenteditable="true"]',
118 ),
119 ).find(belongs);
120 const fallback = Array.from(area.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)).find(
docs/user/keyboard-focus.md
+3 -3
@@ -26,9 +26,9 @@ can be remapped in Settings > Keybindings.
26
27 ## Browse threads
28
29 -Tab enters the sidebar once. Up and Down move between threads without opening them; Enter
30 -opens the focused thread or toggles a group. Right and Left expand and collapse groups.
31 -Tab moves from the focused thread to its buttons. `F2` renames the focused thread.
29 +Tab moves through each thread and its buttons. Up and Down also move between threads
30 +without opening them; Enter opens the focused thread or toggles a group. Right and Left
31 +expand and collapse groups. `F2` renames the focused thread.
32
33 Press `Shift+F10` or the Context Menu key to open the focused thread's menu. Use the arrow
34 keys to move through it, Enter to choose, and Escape to close it.