From 24a110aa0bc9afbbb7e5d48730f1dd8039e82fbf Mon Sep 17 00:00:00 2001 From: HighImKevin Date: Wed, 26 Nov 2025 05:48:37 -0500 Subject: [PATCH] Improve Modal rendering for Headerless and Footerless modals --- scripts/modal.css | 4 ++++ scripts/modal.js | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/modal.css b/scripts/modal.css index c2a631a..11b6f1e 100644 --- a/scripts/modal.css +++ b/scripts/modal.css @@ -129,3 +129,7 @@ color: rgba(0,0,0,.26); cursor: auto } + +.dialog[data-footer="true"] [data-name="kefin-modal-content"] { + margin-bottom: 8em; +} \ No newline at end of file diff --git a/scripts/modal.js b/scripts/modal.js index 9bcd13d..594b96b 100644 --- a/scripts/modal.js +++ b/scripts/modal.js @@ -57,6 +57,7 @@ window.ModalSystem = (function() { dialog.setAttribute('data-history', 'true'); dialog.setAttribute('data-autofocus', 'true'); dialog.setAttribute('data-removeonclose', 'true'); + dialog.setAttribute('data-name', 'kefin-modal'); dialog.style.animation = '160ms ease-out 0s 1 normal both running scaleup'; dialog.style.display = 'flex'; dialog.style.flexDirection = 'column'; @@ -102,7 +103,6 @@ window.ModalSystem = (function() { // Create scrollable content area const dialogContent = document.createElement('div'); - dialogContent.style.marginBottom = '5em'; dialogContent.style.padding = title || footer ? '1.25em 1.5em' : '1.25em 1.5em 1.5em'; dialogContent.style.overflowY = 'auto'; dialogContent.style.flex = '1'; @@ -131,9 +131,12 @@ window.ModalSystem = (function() { } else if (footer instanceof HTMLElement) { dialogFooter.appendChild(footer); } + dialog.dataset.footer = footer ? 'true' : 'false'; } // Assemble modal + dialogContent.setAttribute('data-name', 'kefin-modal-content'); + dialog.appendChild(dialogContent); if (dialogFooter) { dialog.appendChild(dialogFooter);