Skip to content

Text selection loss during incremental AI updates #261

@examan

Description

@examan

Currently, morphdom updates Text nodes by directly replacing the entire nodeValue:

if (morphedNode.nodeValue !== toNode.nodeValue) {
    morphedNode.nodeValue = toNode.nodeValue;
}

When working with AI-generated content, text typically grows incrementally as responses are generated. The current direct replacement approach causes any existing text selection to be lost, disrupting user interaction with the content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions