From 2aeb21a7ba2795565a8eb19f78bede4564f6b4fd Mon Sep 17 00:00:00 2001 From: "Benjamin A. Shelton" Date: Wed, 29 Jul 2026 22:55:24 -0600 Subject: [PATCH] Modal tests. --- src/pages/notes/[...id].astro | 9 +++++++++ src/styles/global.css | 5 +++++ src/utils/modal.js | 14 ++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/pages/notes/[...id].astro b/src/pages/notes/[...id].astro index 542abfd..3a478fa 100644 --- a/src/pages/notes/[...id].astro +++ b/src/pages/notes/[...id].astro @@ -37,6 +37,11 @@ const meta = `{ {meta && +
@@ -55,5 +60,9 @@ const meta = `{
+
\ No newline at end of file diff --git a/src/styles/global.css b/src/styles/global.css index 07e8b4f..2d61b4f 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -54,6 +54,11 @@ } } +html:has(dialog[open]:modal) { + overflow: hidden; + scrollbar-gutter: stable both-edges; +} + body { @apply duration-700 transition-colors; @apply dark:bg-gray-900; diff --git a/src/utils/modal.js b/src/utils/modal.js index bbbeea4..4c9f135 100644 --- a/src/utils/modal.js +++ b/src/utils/modal.js @@ -3,8 +3,18 @@ export const modal = (el) => { }; export const bindModals = () => { - const elems = document.querySelector('a[data-scripture]'); + const elems = document.querySelectorAll('a[data-scripture]'); + const dialog = document.querySelectorAll('dialog[data-scripture]'); elems.forEach((e) => { - console.log(e); + e.addEventListener('click', (evt) => { + const scripture = e.attributes.getNamedItem('data-scripture'); + evt.preventDefault(); + console.log(scripture); + dialog[0]?.showModal(); + dialog[0]?.setAttribute('data-scripture', scripture); + dialog[0]?.classList.remove("hidden"); + //document.body.classList.add("overflow-hidden"); + + }); }); }; \ No newline at end of file