Edit page scroll fix
This isn't perfect but I'm so annoyed with this bug
This commit is contained in:
parent
36d1ff07d3
commit
955617b18b
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue