UX: Only scroll when we surpass max input height (#1288)
This commit is contained in:
parent
cd0cfc0bfc
commit
81ef532268
|
@ -48,5 +48,15 @@ export default class DiscourseAiBotConversations extends Controller {
|
||||||
_autoExpandTextarea() {
|
_autoExpandTextarea() {
|
||||||
this.textarea.style.height = "auto";
|
this.textarea.style.height = "auto";
|
||||||
this.textarea.style.height = this.textarea.scrollHeight + "px";
|
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";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,7 +248,7 @@ body.has-ai-conversations-sidebar {
|
||||||
resize: none;
|
resize: none;
|
||||||
border-radius: var(--d-button-border-radius);
|
border-radius: var(--d-button-border-radius);
|
||||||
max-height: 30vh;
|
max-height: 30vh;
|
||||||
overflow: hidden;
|
overflow-y: hidden;
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
|
|
Loading…
Reference in New Issue