mishig HF staff commited on
Commit
cd2e1ea
1 Parent(s): de2ec19

fix weird jumping behaviour

Browse files
src/lib/components/InferencePlayground/InferencePlaygroundConversation.svelte CHANGED
@@ -22,11 +22,13 @@
22
  function resizeMessageTextAreas() {
23
  // ideally we would use CSS "field-sizing:content". However, it is currently only supported on Chrome.
24
  if (messageContainer) {
 
25
  const textareaEls = messageContainer.querySelectorAll("textarea");
26
  for (const textarea of textareaEls) {
27
  textarea.style.height = "0px";
28
  textarea.style.height = textarea.scrollHeight + "px";
29
  }
 
30
  }
31
  }
32
 
 
22
  function resizeMessageTextAreas() {
23
  // ideally we would use CSS "field-sizing:content". However, it is currently only supported on Chrome.
24
  if (messageContainer) {
25
+ const containerScrollTop = messageContainer.scrollTop;
26
  const textareaEls = messageContainer.querySelectorAll("textarea");
27
  for (const textarea of textareaEls) {
28
  textarea.style.height = "0px";
29
  textarea.style.height = textarea.scrollHeight + "px";
30
  }
31
+ messageContainer.scrollTop = containerScrollTop;
32
  }
33
  }
34