From f8eda421872cf9a375894c6a5efaa404810ed77c Mon Sep 17 00:00:00 2001 From: "Stanko K.R." Date: Wed, 3 Dec 2025 10:32:49 +0100 Subject: [PATCH] Fix crash when inserting an emoji into a max length reaction --- app/javascript/controllers/reaction_emoji_controller.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/javascript/controllers/reaction_emoji_controller.js b/app/javascript/controllers/reaction_emoji_controller.js index 2d2d5bbca..d0ebd47fa 100644 --- a/app/javascript/controllers/reaction_emoji_controller.js +++ b/app/javascript/controllers/reaction_emoji_controller.js @@ -6,7 +6,12 @@ export default class extends Controller { insertEmoji(event) { const emojiChar = event.target.getAttribute("data-emoji") const value = this.inputTarget.value - this.inputTarget.value = `${value}${emojiChar}` + const newValue = `${value}${emojiChar}` + + if (this.inputTarget.maxLength > 0 && newValue.length <= this.inputTarget.maxLength) { + this.inputTarget.value = newValue + } + this.inputTarget.focus() } }