Move focus upwards when pressing Escape

This commit is contained in:
Joscha 2025-02-07 21:09:08 +01:00
parent 903d137cda
commit 5c6c607ea4
2 changed files with 14 additions and 0 deletions

View file

@ -2,8 +2,18 @@
import CNavbar from "./components/CNavbar.vue";
import CNote from "./components/CNote.vue";
import { useUiStore } from "./stores/ui";
import { pathAncestor } from "./util";
const ui = useUiStore();
window.addEventListener("keypress", (ev) => {
if (document.activeElement !== document.body) return;
if (ev.key === "Escape") {
ui.focusPath = pathAncestor(ui.focusPath);
return;
}
});
</script>
<template>