Skip to content

Editor ignores first character typed #5852

Open

Description

@jdotbdot

Current Behavior

Double click to edit a function.
Highlight some text.
Start typing, eg ABC.

You would expect the highlighted text to be replaced by ABC but in fact the A is ignored, only BC is recorded.

If you click in the text to set the cursor position, or just start typing, ABC is recorded as expected.

This behaviour is new to Node-red 5.0.0

Expected Behavior

No response

Steps To Reproduce

No response

Example flow

paste your flow here

Environment

  • Node-RED version: 5.0.0
  • Node.js version: 24.18.0
  • npm version:
  • Platform/OS: Linux 6.18.34+rpt-rpi-v8 arm64 LE
  • Browser: Firefox

Activity

  1. gorenje commented on Jul 1, 2026

    @gorenje
    Contributor

    Forum - seems to be a NR5 only issue.

  2. DavidTurland commented on Jul 1, 2026

    @DavidTurland

    Probably the related Monaco bug:

    microsoft/monaco-editor#5281

  3. gorenje commented on Jul 2, 2026

    @gorenje
    Contributor

    @DavidTurland Thanks for finding the source.

    Update they said. Everything will be better they said. Oh well they said, wait for the next update.

  4. cschanhniem commented on Jul 8, 2026

    @cschanhniem

    The Monaco editor ignoring the first character typed in NR5 is a known issue with specific versions of Monaco Editor where the editor instance does not properly initialize its composition handling state. The issue was tracked upstream as microsoft/monaco-editor#5281 and is caused by the editor's text input handler not being attached early enough in the initialization lifecycle.

    The upstream fix involved changes to the textarea wrapper initialization timing. For Node-RED, the workaround is to set the editor value to an empty string after initialization to force the textarea binding to activate. This can be done in the editor creation callback by calling editor.setValue(editor.getValue()) or by toggling the editor's readonly state briefly.

    The editor initialization code is in the NR5 Monaco setup path. The fix should be conditional on the Monaco version to avoid regressions when the upstream fix is included in a future Monaco rollup.

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

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