Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): preserve composer focus during browser automation #4118

Closedmwolfeio(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/4118/headopened View on GitHub

Showing 4 changed files with 60 additions and 16 deletions (loading 1).

x
0 of 4 viewed, 4 left
6 additions and 3 deletionsapps/web/src/components/preview/PreviewAutomationHosts.tsxModified
View file
@@ -37,6 +37,7 @@
import { resolveBrowserRecordingStopTarget } from "~/browser/browserRecordingScope";
import { useBrowserSurfaceStore } from "~/browser/browserSurfaceStore";
import { isElectron } from "~/env";
+import { runPreservingDocumentFocus } from "~/lib/documentFocus";
import { useEnvironments } from "~/state/environments";
import { previewEnvironment } from "~/state/preview";
import { useAtomQueryRunner } from "~/state/use-atom-query-runner";
@@ -471,9 +472,11 @@
case "press": {
const ready = await requireReadyTab();
- return await ready.bridge.automation.press(
- ready.tabId,
- request.input as Parameters<typeof ready.bridge.automation.press>[1],
+ return await runPreservingDocumentFocus(() =>
+ ready.bridge.automation.press(
+ ready.tabId,
+ request.input as Parameters<typeof ready.bridge.automation.press>[1],
+ ),
case "scroll": {
3 additions and 13 deletionsapps/web/src/components/preview/PreviewView.tsxModified
View file
@@ -10,6 +10,7 @@
import { useCallback, useEffect, useRef, useState } from "react";