From 01e04020046728d17f1c7eb2b6aa4fe432681834 Mon Sep 17 00:00:00 2001 From: Dariush Komeili Date: Wed, 18 Feb 2026 00:05:17 +0000 Subject: [PATCH 1/2] fix: enhance mobile compatibility by preventing keyboard popup and improving layout --- src/lib/components/TerminalInput.svelte | 7 ++++++- src/lib/components/TerminalOutput.svelte | 2 +- src/routes/Terminal.svelte | 20 +++++++++++++++----- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/lib/components/TerminalInput.svelte b/src/lib/components/TerminalInput.svelte index 17ba5ff..bbd5270 100644 --- a/src/lib/components/TerminalInput.svelte +++ b/src/lib/components/TerminalInput.svelte @@ -29,7 +29,12 @@ } } + function isMobile(): boolean { + return typeof window !== 'undefined' && window.matchMedia('(pointer: coarse)').matches; + } + function handleBlur(e: FocusEvent) { + if (isMobile()) return; const target = e.target as HTMLInputElement; target?.focus({ preventScroll: true }); } @@ -67,7 +72,7 @@ onkeydown={handleKeyDown} onblur={handleBlur} type="text" - class="w-full border-none bg-transparent font-mono text-gray-900 outline-none dark:text-gray-100" + class="w-full border-none bg-transparent font-mono text-base text-gray-900 outline-none md:text-sm dark:text-gray-100" style="caret-color: transparent;" spellcheck="false" autocomplete="off" diff --git a/src/lib/components/TerminalOutput.svelte b/src/lib/components/TerminalOutput.svelte index afbd4d9..2610915 100644 --- a/src/lib/components/TerminalOutput.svelte +++ b/src/lib/components/TerminalOutput.svelte @@ -20,7 +20,7 @@ {#each history as entry, i (i)} {#if entry.type === 'greeting'}
{entry.content}
+ class="m-0 max-w-full overflow-x-auto font-mono leading-tight whitespace-pre text-blue-600 dark:text-blue-400">{entry.content} {#if entry.links && entry.links.length > 0}
{#each entry.links as link, k (k)} diff --git a/src/routes/Terminal.svelte b/src/routes/Terminal.svelte index b9bc973..6f79445 100644 --- a/src/routes/Terminal.svelte +++ b/src/routes/Terminal.svelte @@ -32,8 +32,10 @@ // Apply theme to document updateTheme(); - // Focus input - inputElement?.focus(); + // Focus input (skip on mobile to avoid keyboard popup) + if (!isMobile()) { + inputElement?.focus(); + } }); function updateTheme() { @@ -108,6 +110,10 @@ } } + function isMobile(): boolean { + return typeof window !== 'undefined' && window.matchMedia('(pointer: coarse)').matches; + } + function handleLinkClick(link: Link) { if (link.type === 'command') { input = link.target; @@ -115,7 +121,9 @@ } else if (link.type === 'url') { window.open(link.target, '_blank', 'noopener,noreferrer'); } - setTimeout(() => inputElement?.focus({ preventScroll: true }), 0); + if (!isMobile()) { + setTimeout(() => inputElement?.focus({ preventScroll: true }), 0); + } } function handleInput(value: string) { @@ -127,12 +135,14 @@ } function focusInput() { - inputElement?.focus({ preventScroll: true }); + if (!isMobile()) { + inputElement?.focus({ preventScroll: true }); + } }
From f9478d52afe1ec254825f5e920b1f4f303acb68d Mon Sep 17 00:00:00 2001 From: Dariush Komeili Date: Wed, 18 Feb 2026 00:33:20 +0000 Subject: [PATCH 2/2] fix: improve mobile compatibility by using hasOnScreenKeyboard to prevent keyboard popup --- src/lib/components/TerminalInput.svelte | 8 +++----- src/lib/device.ts | 13 +++++++++++++ src/routes/Terminal.svelte | 13 +++++-------- 3 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 src/lib/device.ts diff --git a/src/lib/components/TerminalInput.svelte b/src/lib/components/TerminalInput.svelte index bbd5270..0f090a2 100644 --- a/src/lib/components/TerminalInput.svelte +++ b/src/lib/components/TerminalInput.svelte @@ -1,4 +1,6 @@