diff --git a/admin/index.js b/admin/index.js
index 983c799..6526ba9 100644
--- a/admin/index.js
+++ b/admin/index.js
@@ -42,3 +42,14 @@ document.addEventListener('submit', (e) => {
e.preventDefault();
}
});
+
+// Announcement editor dialog: the server flags it for ?new / ?edit URLs.
+// Closing it any way (× link, Esc) drops the query string, so a reload
+// doesn't reopen it.
+const annModal = document.getElementById('modal-ann');
+if (annModal?.hasAttribute('data-open-on-load')) {
+ annModal.showModal();
+ annModal.addEventListener('close', () => {
+ history.replaceState(null, '', 'index.php');
+ });
+}
diff --git a/admin/index.php b/admin/index.php
index 12459c4..90546f3 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -239,11 +239,10 @@ $announcements = get_all_announcements();
-
-
+
diff --git a/admin/menu.js b/admin/menu.js
index 5b81142..d12cacb 100644
--- a/admin/menu.js
+++ b/admin/menu.js
@@ -5,8 +5,8 @@
const csrfToken = document.body.dataset.csrfToken;
// Item Modal helpers
-const itemModal = document.getElementById('modal-item-backdrop');
-const catModal = document.getElementById('modal-cat-backdrop');
+const itemModal = document.getElementById('modal-item');
+const catModal = document.getElementById('modal-cat');
function openItemModal(itemData = null) {
const title = document.getElementById('modal-item-title');
@@ -37,12 +37,12 @@ function openItemModal(itemData = null) {
availField.checked = true;
}
- itemModal.classList.add('is-open');
+ itemModal.showModal();
nameField.focus();
}
function closeItemModal() {
- itemModal.classList.remove('is-open');
+ itemModal.close();
}
function openCategoryModal(catData = null) {
@@ -63,12 +63,12 @@ function openCategoryModal(catData = null) {
descField.value = '';
}
- catModal.classList.add('is-open');
+ catModal.showModal();
nameField.focus();
}
function closeCategoryModal() {
- catModal.classList.remove('is-open');
+ catModal.close();
}
function escapeHtml(text) {
diff --git a/admin/menu.php b/admin/menu.php
index c676209..9ec0fac 100644
--- a/admin/menu.php
+++ b/admin/menu.php
@@ -328,9 +328,8 @@ $menuEnabled = is_menu_enabled();
-
-
+
-
-
+
diff --git a/admin/users.js b/admin/users.js
index 2514689..3320ca4 100644
--- a/admin/users.js
+++ b/admin/users.js
@@ -5,9 +5,9 @@
const csrfToken = document.body.dataset.csrfToken;
const currentUserId = document.body.dataset.currentUserId;
-const userModal = document.getElementById('modal-user-backdrop');
-const passwordModal = document.getElementById('modal-password-backdrop');
-const editModal = document.getElementById('modal-edit-backdrop');
+const userModal = document.getElementById('modal-user');
+const passwordModal = document.getElementById('modal-password');
+const editModal = document.getElementById('modal-edit');
function escapeHtml(text) {
const div = document.createElement('div');
@@ -54,16 +54,14 @@ function openUserModal() {
const form = document.getElementById('form-user');
form.reset();
resetPasswordVisibility(form);
- userModal.classList.add('is-open');
+ userModal.showModal();
}
-// Safari ignores autocomplete="off" on fields labeled "Username" and offers
-// saved logins whenever one has focus. The modals used to auto-focus that
-// field, and a closed modal left it focused, so the prompt kept popping up.
-// Now nothing is auto-focused, and closing a modal drops focus.
+// Native
-
-
+
-
-
+
diff --git a/src/scss/components/_admin-modal.scss b/src/scss/components/_admin-modal.scss
index 35634e8..dfbc89c 100644
--- a/src/scss/components/_admin-modal.scss
+++ b/src/scss/components/_admin-modal.scss
@@ -1,49 +1,62 @@
/* ---------- admin modal dialogs ---------- */
-.admin-modal-backdrop {
- position: fixed;
- inset: 0;
- background: rgba(15, 12, 10, 0.8);
- backdrop-filter: blur(0.25rem);
- display: flex;
- align-items: center;
- justify-content: center;
- z-index: 1000;
- padding: 1.5rem;
- opacity: 0;
- pointer-events: none;
- // Closed modals must be visibility: hidden, not just transparent —
- // otherwise their fields stay focusable and Safari offers saved logins
- // for an invisible Username field. The visibility switch waits for the
- // fade-out to finish so the close animation still plays.
- visibility: hidden;
- transition: opacity .2s ease, visibility 0s linear .2s;
-}
-
-.admin-modal-backdrop.is-open {
- opacity: 1;
- pointer-events: auto;
- visibility: visible;
- transition: opacity .2s ease, visibility 0s;
-}
-
+/* Native