Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): composer regains focus when you tab back into T3 Code #10463

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/10463/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 3 changed files with 98 additions and 0 deletions.

x
0 of 3 viewed, 3 left
43 additions and 0 deletionsapps/web/src/components/ChatView.logic.test.tsModified
View file
@@ -42,6 +42,7 @@
getStartedThreadModelChangeBlockReason,
hasEnvironmentReconnectWarningGraceElapsed,
hasServerAcknowledgedLocalDispatch,
+ shouldRefocusComposerOnWindowFocus,
isBranchMismatchDismissedForSession,
reconcileMountedTerminalThreadIds,
reconcileRetainedMountedThreadIds,
@@ -1861,3 +1862,45 @@
).toBe(true);
+​
+describe("shouldRefocusComposerOnWindowFocus", () => {
+ function element(
+ tagName: string,
+ options?: { editable?: boolean; role?: string; within?: string },
+ ) {
+ return {
+ tagName,
+ isContentEditable: options?.editable ?? false,
+ getAttribute: (name: string) => (name === "role" ? (options?.role ?? null) : null),
+ closest: (selector: string) =>
+ options?.within !== undefined && selector.includes(options.within) ? ({} as Element) : null,
+ };
+ }
+​
+ it("refocuses when nothing or the body holds focus", () => {
+ expect(shouldRefocusComposerOnWindowFocus(null)).toBe(true);