[bugfix] make sure previous card is not shown in modal by defaulting to "loading..."

This commit is contained in:
2026-03-05 12:10:55 -05:00
parent f2b0309b6e
commit 4ec64dca18
2 changed files with 3 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ window.bootstrap = bootstrap;
// trap browser back and close the modal if open
const cardModal = document.getElementById('cardModal');
const loadingMsg = cardModal.innerHTML;
// Push a new history state when the modal is shown
cardModal.addEventListener('shown.bs.modal', () => {
history.pushState({ modalOpen: true }, null, '#cardModal');
@@ -19,6 +20,7 @@ window.addEventListener('popstate', (e) => {
});
// Trigger a back navigation when the modal is closed via its native controls (X, backdrop click)
cardModal.addEventListener('hide.bs.modal', () => {
cardModal.innerHTML = loadingMsg;
if (history.state && history.state.modalOpen) {
history.back();
}