Skip to content

fix(frontend): replace field-sizing:content with JS auto-resize to fix CJK cursor offset - #1298

Open
X33834 wants to merge 1 commit into
chaitin:mainfrom
X33834:fix/chat-input-cursor-cjk
Open

X33834 wants to merge 1 commit into
chaitin:mainfrom
X33834:fix/chat-input-cursor-cjk

Conversation

@X33834

@X33834 X33834 commented Sep 17, 2026

Copy link
Copy Markdown

Closes: #1224

Problem

TaskChatInputBox's textarea uses [field-sizing:content] (field-sizing: content). With full-width (CJK) characters the browser misrenders the caret, so the visible cursor drifts ~one full-width char to the right of the real insertion point (worst at line ends / after CJK text).

Root cause

field-sizing: content has known caret/selection rendering quirks for CJK text in the textarea. Notably, the other two task textareas in this repo already avoid it: create-default-task-dialog.tsx and start-develop-task-dialog.tsx both use field-sizing-fixed.

Fix

  • Remove [field-sizing:content] from the task chat inputbox textarea.
  • Keep the auto-grow behavior by syncing textarea.style.height from scrollHeight in an effect keyed on content (falls back to min-h-8 when empty, capped by max-h-36 + overflow-y-auto).

This preserves the auto-resizing UX while eliminating the CJK caret offset.

Verification

  • eslint src/components/console/task/chat-inputbox.tsx — clean
  • tsc -b — clean
  • vite build --mode online — succeeds

…sk chat input

field-sizing:content misrenders the caret for full-width (CJK) characters in
the task chat inputbox. Drop it and sync the textarea height from scrollHeight
instead, keeping min-h-8/max-h-36 bounds and overflow scrolling.

Closes chaitin#1224
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

输入全角字符后光标位置偏移约 1 个全角字符

1 participant