+density on list

This commit is contained in:
Simon Martens
2026-01-16 23:04:07 +01:00
parent 0842f270b0
commit 0c63846024
8 changed files with 331 additions and 98 deletions

View File

@@ -218,6 +218,9 @@ function TextareaAutoResize(textarea) {
console.log("Not a textarea element");
return;
}
if (textarea.dataset.noAutoresize === "true" || textarea.classList.contains("no-autoresize")) {
return;
}
// Skip if not visible
if (textarea.offsetParent === null) {
@@ -263,6 +266,9 @@ function HookupTextareaAutoResize(textarea) {
console.warn("HookupTextareaAutoResize: Provided element is not a textarea.");
return;
}
if (textarea.dataset.noAutoresize === "true" || textarea.classList.contains("no-autoresize")) {
return;
}
// If browser supports field-sizing, CSS handles it
if (supportsFieldSizing()) {
@@ -346,6 +352,9 @@ function FormLoad(form) {
// Attach resize handler to all textareas
for (const textarea of textareas) {
if (textarea.dataset.noAutoresize === "true" || textarea.classList.contains("no-autoresize")) {
continue;
}
console.log("Attaching input listener to:", textarea.name || textarea.id);
textarea.addEventListener("input", function () {
console.log("Input event on textarea:", this.name || this.id);
@@ -357,6 +366,9 @@ function FormLoad(form) {
setTimeout(() => {
console.log("Running initial textarea resize on", textareas.length, "textareas");
for (const textarea of textareas) {
if (textarea.dataset.noAutoresize === "true" || textarea.classList.contains("no-autoresize")) {
continue;
}
TextareaAutoResize(textarea);
}
}, 200);
@@ -382,6 +394,9 @@ function FormLoad(form) {
const textareasInTarget = target.matches("textarea") ? [target] : Array.from(target.querySelectorAll("textarea"));
for (const textarea of textareasInTarget) {
if (textarea.dataset.noAutoresize === "true" || textarea.classList.contains("no-autoresize")) {
continue;
}
// Only resize if now visible
if (textarea.offsetParent !== null) {
TextareaAutoResize(textarea);