Skip to content

Commit 9c05abc

Browse files
committed
Avoid js error if alert button is not on page, save page url on history state change
1 parent 8b5f80f commit 9c05abc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

public/js/app.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ VvvebTheme.Alert = {
306306
}
307307
}
308308

309-
document.querySelector('.alert-top .btn-close').addEventListener('click', function (e) {
309+
document.querySelector('.alert-top .btn-close')?.addEventListener('click', function (e) {
310310
let alert = this.closest(".alert");
311311
alert.classList.remove('show')
312312
alert.style.display = "";
@@ -714,7 +714,7 @@ document.addEventListener("click", function (e) {
714714
let target = document.querySelector(selector);
715715
target.scrollIntoView({behavior: "smooth", block: element.dataset.scroll ?? "center", inline: "center"});
716716
}
717-
window.history.pushState({url, selector}, null);
717+
window.history.pushState({url, selector}, null, url);
718718
});
719719

720720
e.preventDefault();

0 commit comments

Comments
 (0)