Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit cc744f1

Browse files
committed
UX: Only scroll when we surpass max input height
1 parent 60ea590 commit cc744f1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

assets/javascripts/discourse/controllers/discourse-ai-bot-conversations.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,15 @@ export default class DiscourseAiBotConversations extends Controller {
4848
_autoExpandTextarea() {
4949
this.textarea.style.height = "auto";
5050
this.textarea.style.height = this.textarea.scrollHeight + "px";
51+
52+
// Get the max-height value from CSS (30vh)
53+
const maxHeight = parseInt(getComputedStyle(this.textarea).maxHeight, 10);
54+
55+
// Only enable scrolling if content exceeds max-height
56+
if (this.textarea.scrollHeight > maxHeight) {
57+
this.textarea.style.overflowY = "auto";
58+
} else {
59+
this.textarea.style.overflowY = "hidden";
60+
}
5161
}
5262
}

assets/stylesheets/modules/ai-bot-conversations/common.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ body.has-ai-conversations-sidebar {
240240
resize: none;
241241
border-radius: var(--d-button-border-radius);
242242
max-height: 30vh;
243-
overflow: hidden;
243+
overflow-y: hidden;
244244

245245
&:focus {
246246
outline: none;

0 commit comments

Comments
 (0)