Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): restore renderer focus after preview presses #9849

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

Showing 3 changed files with 8 additions and 5 deletions (loading 2).

x
0 of 3 viewed, 3 left
8 additions and 5 deletionsapps/web/src/components/preview/PreviewAutomationHosts.tsxModified
View file
@@ -45,6 +45,7 @@
import { runBrowserViewportMutation } from "~/browser/browserViewportActions";
import { previewRuntimeTabId } from "~/browser/previewRuntimeTabId";
import { isElectron } from "~/env";
+import { withPreviewAutomationFocus } from "~/lib/previewAutomationFocus";
import { useEnvironments } from "~/state/environments";
import { previewEnvironment } from "~/state/preview";
import { useAtomQueryRunner } from "~/state/use-atom-query-runner";
@@ -652,11 +653,13 @@
case "press": {
- const ready = await requireReadyTab();
- return await ready.bridge.automation.press(
- ready.runtimeTabId,
- request.input as Parameters<typeof ready.bridge.automation.press>[1],
- );
+ return await withPreviewAutomationFocus(async () => {
+ const ready = await requireReadyTab();
+ return await ready.bridge.automation.press(
+ ready.runtimeTabId,
+ request.input as Parameters<typeof ready.bridge.automation.press>[1],
+ );
+ });
case "scroll": {
const ready = await requireReadyTab();