fix(collections): Close/Cancel removed the hidden confirm dialog, not the modal

closeCollectionModal picked document.querySelector(".fixed.inset-0") —
the FIRST overlay in DOM order, which is the sitewide #confirm-modal
that the header renders (hidden, display:none, but present). The real
create/edit modal stayed open: every Close and Cancel click on the
collection modals did nothing. Caught by the knob-matrix spec — the
pencil-glyph case clicked Close and the Edit modal persisted.

The buttons now pass $el and the overlay OWNING the button is closed
(closest(".fixed.inset-0")), falling back to #modal-container's child
for non-Alpine callers. Both the collection create/edit modal and the
restore-system modal take the argument.
This commit is contained in:
John O'Keefe committed 2026-10-31 15:40:21 -04:00
1 parent 21142cae5f
commit 79b47c9680
6 files changed
+20 -13

No files matched your search

@@ -10,7 +10,7 @@ templ RestoreSystemCollectionModal() {
</span>
<h2 class="text-xl font-bold" style="color: var(--text-primary)">Restore System Collection</h2>
</div>
<button type="button" @click="closeCollectionModal()" class="icon-btn" aria-label="Close">
<button type="button" @click="closeCollectionModal($el)" class="icon-btn" aria-label="Close">
@Icon("close", "h-5 w-5")
</button>
</div>
@@ -29,7 +29,7 @@ templ RestoreSystemCollectionModal() {
<option value="Continue Series">Continue Series</option>
</select>
<div class="flex justify-end space-x-3 mt-6">
<button type="button" @click="closeCollectionModal()" class="btn btn-secondary">Cancel</button>
<button type="button" @click="closeCollectionModal($el)" class="btn btn-secondary">Cancel</button>
<button type="submit" class="btn btn-primary">Restore</button>
</div>
</form>