use browser history api to avoid page jumps on hash change

This commit is contained in:
Bryton Hall 2022-08-29 00:24:11 -04:00
parent ccfc05d200
commit 53adf2b3b7

View file

@ -8,7 +8,7 @@
options[i].getElementsByTagName("summary")[0].onclick = function() { options[i].getElementsByTagName("summary")[0].onclick = function() {
// set URL fragment to option id // set URL fragment to option id
window.location.hash = this.parentElement.id; history.pushState({}, "", `#${this.parentElement.id}`);
// is current panel open, return immediately as it's just being closed // is current panel open, return immediately as it's just being closed
if (this.parentElement.hasAttribute("open")) return; if (this.parentElement.hasAttribute("open")) return;