Fix modal visibility using CSS class instead of HTML hidden attribute
Replace hidden attribute + [hidden] CSS selector with a .modal-open class toggle. The hidden attribute approach was unreliable because CSS display:flex was winning the specificity battle. Class-based show/hide is explicit and not subject to attribute/cascade conflicts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -184,7 +184,7 @@ $page_title = $session ? 'Edit: ' . htmlspecialchars($session['name']) : 'Rosary
|
||||
|
||||
|
||||
<!-- ── Create / Edit Prayer Modal ─────────────────────────────── -->
|
||||
<div id="prayer-modal" class="modal-overlay" hidden>
|
||||
<div id="prayer-modal" class="modal-overlay">
|
||||
<div class="modal-box">
|
||||
<h3 id="modal-title">New Custom Prayer</h3>
|
||||
|
||||
|
||||
@@ -461,19 +461,21 @@
|
||||
|
||||
/* ── Modal ───────────────────────────────────────────────────── */
|
||||
|
||||
.modal-overlay[hidden] { display: none; }
|
||||
|
||||
.modal-overlay {
|
||||
display: none; /* hidden by default; JS adds .modal-open to show */
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0,0,0,0.45);
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.modal-overlay.modal-open {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.modal-box {
|
||||
background: var(--bg-card);
|
||||
border-radius: 12px;
|
||||
|
||||
@@ -257,12 +257,12 @@
|
||||
|
||||
updateModalFields();
|
||||
updateAttrRadioStyles();
|
||||
modal.hidden = false;
|
||||
modal.classList.add('modal-open');
|
||||
document.getElementById('modal-name').focus();
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
document.getElementById('prayer-modal').hidden = true;
|
||||
document.getElementById('prayer-modal').classList.remove('modal-open');
|
||||
editingPrayerId = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user