Skip to content

Build your personal knowledge base with Trilium Notes

fix(board): escape not working in "Add column"

Elian Dorana8992d08b38f
diff --git a/apps/client/src/widgets/collections/board/index.tsx b/apps/client/src/widgets/collections/board/index.tsx
index 519e1103cf..811ae5d18e 100644
--- a/apps/client/src/widgets/collections/board/index.tsx
+++ b/apps/client/src/widgets/collections/board/index.tsx
@@ -243,7 +243,7 @@ export function TitleEditor({ currentValue, placeholder, save, dismiss, mode, is
const shouldDismiss = useRef(false);
useEffect(() => {
- focusElRef.current = document.activeElement;
+ focusElRef.current = document.activeElement !== document.body ? document.activeElement : null;
inputRef.current?.focus();
inputRef.current?.select();
}, [ inputRef ]);
@@ -259,9 +259,11 @@ export function TitleEditor({ currentValue, placeholder, save, dismiss, mode, is
if (e.key === "Enter" || e.key === "Escape") {
e.preventDefault();
e.stopPropagation();
- shouldDismiss.current = (e.key === "Escape");
if (focusElRef.current instanceof HTMLElement) {
+ shouldDismiss.current = (e.key === "Escape");
focusElRef.current.focus();
+ } else {
+ dismiss();
}
}
};