viewer: prevent sidebar typing leak (fix #437)

pull/460/head
Varun Patil 2023-02-23 22:18:06 -08:00
parent c9fc7c3c60
commit 6a37009b02
1 changed files with 12 additions and 8 deletions

View File

@ -1029,16 +1029,20 @@ export default defineComponent({
}, },
handleAppSidebarOpen() { handleAppSidebarOpen() {
if (this.show && this.photoswipe) { if (!(this.show && this.photoswipe)) return;
const sidebar: HTMLElement =
document.querySelector("aside.app-sidebar"); const sidebar: HTMLElement = document.querySelector("aside.app-sidebar");
if (sidebar) { if (sidebar) {
this.sidebarWidth = sidebar.offsetWidth - 2; this.sidebarWidth = sidebar.offsetWidth - 2;
// Stop sidebar typing from leaking to viewer
sidebar.addEventListener("keydown", (e) => {
if (e.key.length === 1) e.stopPropagation();
});
} }
this.sidebarOpen = true; this.sidebarOpen = true;
this.updateSizeWithoutAnim(); this.updateSizeWithoutAnim();
}
}, },
handleAppSidebarClose() { handleAppSidebarClose() {