Skip to content

[Bug] Enter Key Inserts Newline in Topic Input #2001

@kaangrbz

Description

@kaangrbz

What did I do

While editing a topic in the subscription input field, I pressed Enter while the cursor was in the middle of the topic string.

Example topic: 27466482/WM/RES
If I place my cursor after the W and press Enter, the modal both submits/closes (as expected) and inserts an unwanted newline character into the topic.

What happened

MQTTX subscribed to an incorrect topic because pressing Enter inserted a newline (\r\n) into the topic input.

Using the example above, MQTTX ends up subscribing to:

27466482/W
M/RES

instead of the intended single-line topic.

Expected

Pressing Enter inside the topic input should:

  • Trigger the modal action (add/edit subscription) only,
  • Not insert a newline character into the topic string.

The topic input should always remain single-line.

Environment

  • OS: macOS 15.6.1
  • MQTTX version: v1.12.1

More detail

The issue seems to be that the topic field is accepting and storing newline characters (\r\n) when pressing Enter, even though it should behave as a single-line input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions