History implementation appears to cause issues in Chrome.

It would seem that Chrome's history state with dialog.showModal causes
issues requiring hitting "back" twice, even if history.pushState isn't
ever used.
This commit is contained in:
Benjamin A. Shelton 2026-08-20 08:32:10 -06:00
commit 8b5d92591d
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01

View file

@ -80,9 +80,11 @@ class RenderScripture {
constructor(dialog) { constructor(dialog) {
this.dialog = dialog; this.dialog = dialog;
/*history.replaceState({dialog: false}, '');
window.addEventListener('popstate', (evt) => { window.addEventListener('popstate', (evt) => {
console.log("popState", evt);
this.closeDialog(); this.closeDialog();
}); });*/
if (hasLocalStorage()) { if (hasLocalStorage()) {
this.ls = true; this.ls = true;
@ -126,11 +128,12 @@ class RenderScripture {
.classList.remove('hidden'); .classList.remove('hidden');
this.buildTranslationList(this.sel); this.buildTranslationList(this.sel);
this.readScripture(refs); this.readScripture(refs);
history.pushState({ console.log("pushState()");
/*history.pushState({
dialog: true, dialog: true,
scripture: scripture.value, scripture: scripture.value,
tx: this.translation tx: this.translation
}, ''); }, '', '#dialog');*/
} }
buildTranslationList(sel) { buildTranslationList(sel) {
@ -154,6 +157,8 @@ class RenderScripture {
this.dialog[0]?.close(); this.dialog[0]?.close();
this.dialog[0]?.classList.add('hidden'); this.dialog[0]?.classList.add('hidden');
this.dialog[0]?.querySelector('article')?.replaceChildren(); this.dialog[0]?.querySelector('article')?.replaceChildren();
history.replaceState({}, '', '');
//history.back();
} }
txnOnChange(evt) { txnOnChange(evt) {