Skip to content

RichTextEditor emits spurious <p></p> value change when using LAZY or TIMEOUT ValueChangeMode #8730

@peholmst

Description

@peholmst

Description

When a RichTextEditor has its value set programmatically and uses ValueChangeMode.LAZY or ValueChangeMode.TIMEOUT, it fires an unexpected intermediate value change event with <p></p> on initial load — before any user interaction. This occurs with both the classic ValueChangeListener API and the newer Signals API.

When the initial value is programmatically set to <p>hello world</p>, the sequence is:

<p>hello world</p> → <p></p> → <p>hello world</p>

Expected outcome

I would not expect any events until I actually start changing the value.

Minimal reproducible example

import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.richtexteditor.RichTextEditor;
import com.vaadin.flow.data.value.ValueChangeMode;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.signals.impl.Effect;
import com.vaadin.flow.signals.local.ValueSignal;

@Route("")
public class SignalView extends VerticalLayout {

    private final ValueSignal<String> signal = new ValueSignal<>("<p>hello world</p>");

    public SignalView() {
        var rte = new RichTextEditor();
        rte.setValueChangeMode(ValueChangeMode.LAZY);
        rte.bindValue(signal, signal::set);
        Effect.effect(this, () -> {
            System.out.println("Signal value: " + signal.get());
        });
        add(rte);
    }
}

Steps to reproduce

  1. Create a new empty application at start.vaadin.com, using Vaadin 25.1 (pre).
  2. Add the above view to the application and start it.
  3. Navigate to the view without editing the text in the editor at all.
  4. Observe the console output.

Environment

Vaadin version(s): 25.1.0-alpha9
OS: macOS 26.3

Browsers

Chrome

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions