Skip to content

fix(subscriptions): prevent newlines in topic and alias textarea inputs#2018

Merged
Red-Asuka merged 1 commit intomainfrom
fix/subscription-textarea-enter-key
Jan 15, 2026
Merged

fix(subscriptions): prevent newlines in topic and alias textarea inputs#2018
Red-Asuka merged 1 commit intomainfrom
fix/subscription-textarea-enter-key

Conversation

@ysfscream
Copy link
Copy Markdown
Member

@ysfscream ysfscream commented Jan 14, 2026

Summary

  • Prevent Enter key from inserting newlines in subscription topic and alias textarea fields
  • Strip any existing newline characters when saving subscriptions
  • Applied to both desktop and web versions

Related to #2001 and #1874

Test plan

  • Open a subscription form and try pressing Enter in the topic field - should not insert newline
  • Open a subscription form and try pressing Enter in the alias field - should not insert newline
  • Paste text with newlines into topic/alias fields and save - newlines should be stripped

Copilot AI review requested due to automatic review settings January 14, 2026 02:54
@ysfscream ysfscream requested a review from Red-Asuka January 14, 2026 02:55
@ysfscream ysfscream self-assigned this Jan 14, 2026
@ysfscream ysfscream added enhancement New feature or request fix Fix bug or issues web MQTTX Web desktop MQTTX Desktop labels Jan 14, 2026
@ysfscream ysfscream moved this to In Progress in MQTTX Jan 14, 2026
@ysfscream ysfscream added this to the v1.13.0 milestone Jan 14, 2026
Prevent Enter key from inserting newlines in subscription topic and
alias fields, and strip any existing newline characters when saving.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prevents newline characters from being entered or saved in subscription topic and alias fields by adding keyboard event handlers and sanitization logic.

Changes:

  • Added event handlers to prevent Enter key from inserting newlines in topic and alias textarea inputs
  • Added regex-based sanitization to strip any newline characters before saving subscriptions
  • Applied changes consistently to both web and desktop versions

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
web/src/components/SubscriptionsList.vue Added @keydown.enter.native.prevent and @keyup.enter.native.prevent handlers to topic and alias inputs, plus newline stripping in saveSubs()
src/components/SubscriptionsList.vue Added @keydown.enter.native.prevent and @keyup.enter.native.prevent handlers to topic and alias inputs, plus newline stripping in saveSubs()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ysfscream ysfscream force-pushed the fix/subscription-textarea-enter-key branch from e0ce362 to 9c7c1fc Compare January 14, 2026 03:00
@Red-Asuka Red-Asuka merged commit 8b3f3ce into main Jan 15, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in MQTTX Jan 15, 2026
@Red-Asuka Red-Asuka deleted the fix/subscription-textarea-enter-key branch January 15, 2026 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop MQTTX Desktop enhancement New feature or request fix Fix bug or issues web MQTTX Web

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants