Edit page scroll fix

This isn't perfect but I'm so annoyed with this bug
This commit is contained in:
Matthias Portzel 2023-10-05 17:22:31 -04:00
parent 36d1ff07d3
commit 955617b18b
1 changed files with 4 additions and 2 deletions

View File

@ -38,16 +38,18 @@
const textEl = document.getElementById("id_text");
const textExtEl = document.getElementById("id_extended_text");
const scrollEl = document.getElementById("main-wrap");
function updateBoxHeight(box) {
// Save scroll position
const scrollY = window.scrollY;
const scrollY = scrollEl.scrollTop;
//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);
scrollEl.scrollTo(0, scrollY);
}
// If we're handling maxlength in JS, then having the maxlength attribute is annoying