From 2a73d5630bea51e57ec54c0f9c187b8907fbd2e7 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath <2+defunkt@users.noreply.github.com> Date: Thu, 2 Oct 2025 13:00:07 -0700 Subject: [PATCH] focus when ready --- src/js/commands.ts | 2 ++ src/js/focus.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js/commands.ts b/src/js/commands.ts index fce3fdc..8e9d043 100644 --- a/src/js/commands.ts +++ b/src/js/commands.ts @@ -7,6 +7,7 @@ import { resize } from "./resize" import { autoScroll } from "./scrollback" import { sessionId } from "./session" import { send } from "./websocket" +import { focusInput } from "./focus" export const commands: string[] = [] @@ -27,6 +28,7 @@ export const browserCommands: Record void | Promi document.body.dataset.mode = mode resize() autoScroll() + focusInput() }, reload: () => window.location.reload(), } diff --git a/src/js/focus.ts b/src/js/focus.ts index be59fd3..03f2a7e 100644 --- a/src/js/focus.ts +++ b/src/js/focus.ts @@ -5,7 +5,7 @@ import { cmdInput } from "./dom" export function initFocus() { window.addEventListener("click", focusHandler) - setTimeout(() => focusInput(), 10) + focusInput() } export function focusInput() {