Skip to content

Fix/prevent cursor from jumping to end when editing component text - #878

Merged
brauliodiez merged 1 commit into
devfrom
fix/input-cursor-position
Jul 27, 2026
Merged

Fix/prevent cursor from jumping to end when editing component text #878
brauliodiez merged 1 commit into
devfrom
fix/input-cursor-position

Conversation

@ivanruizcode

@ivanruizcode ivanruizcode commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Inline-edit inputs (shown when double-clicking a canvas component to change its text) rendered the cursor at the end of the field on every keystroke, making it impossible to move back and edit previous words. The inputs were controlled (value + onChange), but they're mounted through react-konva-utils' Html, which renders its children into a separate React root and re-renders them out-of-band on every update. Because that re-render happens outside the root that owns the input, React re-applied the DOM .value on each change and the browser reset the caret to the end.

The fix makes the <input> and <textarea> uncontrolled (defaultValue instead of value) in html-edit.widget.tsx. This is safe because the submit logic already reads the final text directly from the input ref rather than from React state, so no functional behavior changes — the caret now simply stays where the user placed it. Affects all inline-editable components (inputs, textareas, headings, paragraphs, links, etc.) since they share this widget.

@ivanruizcode ivanruizcode changed the title fix: prevent cursor from jumping to end when editing component text Fix/prevent cursor from jumping to end when editing component text Jul 27, 2026
@brauliodiez
brauliodiez merged commit d67c58a into dev Jul 27, 2026
6 checks passed
@brauliodiez
brauliodiez deleted the fix/input-cursor-position branch July 27, 2026 07:47
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.

2 participants