diff --git a/main/templates/whispermaphone/post.html b/main/templates/whispermaphone/post.html index 7581daf..951336f 100644 --- a/main/templates/whispermaphone/post.html +++ b/main/templates/whispermaphone/post.html @@ -40,11 +40,15 @@ const textExtEl = document.getElementById("id_extended_text"); function updateBoxHeight(box) { + // Save scroll position + const scrollY = window.scrollY; //style.height doesn't include padding, .scrollHeight does box.style.height = "auto"; // Set overflow hidden to ensure scrollbars aren't shown, since they change the width and thus the height box.style.overflow = "hidden"; box.style.height = box.scrollHeight + "px"; + //Restore scroll position + window.scrollTo(0, scrollY); } // If we're handling maxlength in JS, then having the maxlength attribute is annoying