Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(share): close mobile panels when a page returns from the bfcache
perfectra1n663d45dc4ad2
diff --git a/packages/share-theme/src/scripts/modules/mobile.ts b/packages/share-theme/src/scripts/modules/mobile.tsindex 8a76fddfec..bcb2e38e14 100644--- a/packages/share-theme/src/scripts/modules/mobile.ts+++ b/packages/share-theme/src/scripts/modules/mobile.ts@@ -2,6 +2,12 @@ export default function setupMobileMenu() {// A listener on the backdrop itself, not on `window`: iOS Safari dispatches no `click` for a// tap on an element it does not consider clickable, and `window` listeners do not count.document.getElementById("mobile-backdrop")?.addEventListener("click", closeMobileMenus);++ // Going back to a page restored from the back/forward cache keeps the panel that was+ // open when the user tapped a link in it.+ window.addEventListener("pageshow", e => {+ if (e.persisted) closeMobileMenus();+ });}export function closeMobileMenus() {