Monitor pushState/popState for dismissing dialog(s).

This commit is contained in:
Benjamin A. Shelton 2026-08-19 17:53:26 -06:00
commit ae202e9ce6
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01

View file

@ -80,6 +80,10 @@ class RenderScripture {
constructor(dialog) { constructor(dialog) {
this.dialog = dialog; this.dialog = dialog;
window.addEventListener('popstate', (evt) => {
this.closeDialog();
});
if (hasLocalStorage()) { if (hasLocalStorage()) {
this.ls = true; this.ls = true;
this.translation = localStorage.getItem('__translation') || 'BSB'; this.translation = localStorage.getItem('__translation') || 'BSB';
@ -122,6 +126,11 @@ class RenderScripture {
.classList.remove('hidden'); .classList.remove('hidden');
this.buildTranslationList(this.sel); this.buildTranslationList(this.sel);
this.readScripture(refs); this.readScripture(refs);
history.pushState({
dialog: true,
scripture: scripture.value,
tx: this.translation
}, '');
} }
buildTranslationList(sel) { buildTranslationList(sel) {