From 41a209e96ddac00710ed84d7bb748a05e1dcdb0a Mon Sep 17 00:00:00 2001 From: Teigen Date: Sat, 13 Jun 2026 18:49:57 +0800 Subject: [PATCH] fix(cjk): hide CJK textarea on welcome screen and fix vertical centering - Guard `_updateCjkInputState()` with `activeSessionId` check so the `position: fixed` CJK textarea doesn't float over the welcome overlay - Call `_updateCjkInputState()` in `showWelcome()`/`hideWelcome()` to sync CJK visibility on session enter/leave - Add `padding: 12px 10px` to `.cjk-input-visible textarea` for proper vertical centering of input text --- src/web/public/app.js | 8 +++++++- src/web/public/styles.css | 1 + src/web/public/terminal-ui.js | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/web/public/app.js b/src/web/public/app.js index 29f76167..1d016e35 100644 --- a/src/web/public/app.js +++ b/src/web/public/app.js @@ -2103,7 +2103,13 @@ class CodemanApp { // Mobile defaults ship cjkInputEnabled: false (native terminal input by // default on touch), but an explicit user enable is honored everywhere — // the App Settings toggle must not be a silent no-op on phones. - const showCjk = this._serverCjkOverride || (settings.cjkInputEnabled ?? defaults.cjkInputEnabled ?? false); + // The welcome/home screen (no active session) has nothing to type into. + // Force-hide the CJK textarea there — otherwise the `position: fixed` + // `.cjk-input-visible` rule floats it over the welcome overlay and blocks + // content. Re-synced on session enter/leave via hideWelcome()/showWelcome(). + const cjkUserEnabled = + this._serverCjkOverride || (settings.cjkInputEnabled ?? defaults.cjkInputEnabled ?? false); + const showCjk = cjkUserEnabled && !!this.activeSessionId; cjkEl.classList.toggle('cjk-input-visible', !!showCjk); document.body.classList.toggle('cjk-input-visible', !!showCjk); cjkEl.style.display = showCjk ? 'block' : 'none'; diff --git a/src/web/public/styles.css b/src/web/public/styles.css index 2b5a0e91..39c8aa39 100644 --- a/src/web/public/styles.css +++ b/src/web/public/styles.css @@ -8778,6 +8778,7 @@ kbd { display: block; min-height: 44px; max-height: 96px; + padding: 12px 10px; border: 1px solid rgba(80, 120, 190, 0.55); border-left: none; border-right: none; diff --git a/src/web/public/terminal-ui.js b/src/web/public/terminal-ui.js index 1f8f8577..bba4f302 100644 --- a/src/web/public/terminal-ui.js +++ b/src/web/public/terminal-ui.js @@ -943,6 +943,9 @@ Object.assign(CodemanApp.prototype, { this.loadTunnelStatus(); this.loadHistorySessions(); } + // Home screen has no input target — hide the CJK textarea (activeSessionId + // is null by the time we get here). Guarded: defined on the app object. + this._updateCjkInputState?.(); }, hideWelcome() { @@ -956,6 +959,9 @@ Object.assign(CodemanApp.prototype, { clearTimeout(this._welcomeQrShrinkTimer); qrWrap.classList.remove('expanded'); } + // Entering a session — restore CJK textarea if the user has it enabled + // (activeSessionId is already set by selectSession before this call). + this._updateCjkInputState?.(); }, /**