Skip to content

Build your personal knowledge base with Trilium Notes

fix alt shortcuts on mac not triggering

chloelee767644cc27fa709
diff --git a/apps/client/src/services/shortcuts.ts b/apps/client/src/services/shortcuts.ts
index 167dc01d99..63db45302d 100644
--- a/apps/client/src/services/shortcuts.ts
+++ b/apps/client/src/services/shortcuts.ts
@@ -213,8 +213,11 @@ export function keyMatches(e: KeyboardEvent, key: string): boolean {
}
// For letter keys, use the physical key code for consistency
+ // On macOS, Option/Alt key produces special characters, so we must use e.code
if (key.length === 1 && key >= 'a' && key <= 'z') {
- return e.key.toLowerCase() === key.toLowerCase();
+ // e.code is like "KeyA", "KeyB", etc.
+ const expectedCode = `Key${key.toUpperCase()}`;
+ return e.code === expectedCode || e.key.toLowerCase() === key.toLowerCase();
}
// For regular keys, check both key and code as fallback