diff --git a/assets/javascripts/discourse/controllers/discourse-ai-bot-conversations.js b/assets/javascripts/discourse/controllers/discourse-ai-bot-conversations.js index 869b6e97..8b61a5ef 100644 --- a/assets/javascripts/discourse/controllers/discourse-ai-bot-conversations.js +++ b/assets/javascripts/discourse/controllers/discourse-ai-bot-conversations.js @@ -48,5 +48,15 @@ export default class DiscourseAiBotConversations extends Controller { _autoExpandTextarea() { this.textarea.style.height = "auto"; this.textarea.style.height = this.textarea.scrollHeight + "px"; + + // Get the max-height value from CSS (30vh) + const maxHeight = parseInt(getComputedStyle(this.textarea).maxHeight, 10); + + // Only enable scrolling if content exceeds max-height + if (this.textarea.scrollHeight > maxHeight) { + this.textarea.style.overflowY = "auto"; + } else { + this.textarea.style.overflowY = "hidden"; + } } } diff --git a/assets/stylesheets/modules/ai-bot-conversations/common.scss b/assets/stylesheets/modules/ai-bot-conversations/common.scss index f25071e5..b5dbd877 100644 --- a/assets/stylesheets/modules/ai-bot-conversations/common.scss +++ b/assets/stylesheets/modules/ai-bot-conversations/common.scss @@ -248,7 +248,7 @@ body.has-ai-conversations-sidebar { resize: none; border-radius: var(--d-button-border-radius); max-height: 30vh; - overflow: hidden; + overflow-y: hidden; &:focus { outline: none;