Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Inline text editing on the canvas (double-click to edit) #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Inline text editing on the canvas (double-click to edit) #25
Changes from 1 commit
629270df975e9aa0a7f246bfcbf620edb1d6bad4b7ee59e9f41b2575a61708483bf38474473356cfeb1a61b3457b7b265aa23853d84b59ea4fe6f203486ff0File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Typing reset the caret to the start of the heading: each character was written, then the caret jumped to offset 0 and the next character landed there. A MutationObserver + innerHTML trap showed React itself re-applying the element's content on every keystroke: innerHTML.set <- frozen initial value (no typed char) at setProp / updateProperties / commitUpdate (react-dom 19) Root cause: React 19's setProp re-applies dangerouslySetInnerHTML on EVERY commitUpdate of an element — it does not skip on an unchanged __html. The live-commit re-render fires one commit per keystroke (the inline handlers are fresh closures each render, so the element always has a prop update), so React kept overwriting the user's edit with the stale seeded HTML and collapsing the caret. A 'frozen' dangerouslySetInnerHTML cannot work: React owning a contentEditable element's content is fundamentally incompatible with the browser mutating it. Fix: React no longer owns the editing element's content. inlineEditableElementProps provides only contentEditable + the handlers + ref — no dangerouslySetInnerHTML, no children — so there is no content prop for React to re-apply. The canvas seeds the element imperatively once on session start (seedInlineEditableContent, escaped value with \n -> <br>) in the same layout effect that focuses it. React leaves the contentEditable DOM alone for the rest of the session. Verified in a real browser: typing at the end accumulates and the caret stays at the end; inserting mid-string lands at the caret and stays there; live commit to the other breakpoint frames still works. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
Uh oh!
There was an error while loading. Please reload this page.