From ce30ebec67a90c5b755464e74d3e70c194194fce Mon Sep 17 00:00:00 2001
From: sengoku-f <31064651+sengoku-f@users.noreply.github.com>
Date: Mon, 24 Mar 2025 21:06:41 +0800
Subject: [PATCH] fix: fix `command+k` hotkey on macOS devices (#178)
---
.changes/macos-meta.md | 5 +++++
src/useDocSearchHotKeys.ts | 5 +++--
2 files changed, 8 insertions(+), 2 deletions(-)
create mode 100644 .changes/macos-meta.md
diff --git a/.changes/macos-meta.md b/.changes/macos-meta.md
new file mode 100644
index 0000000..43b5ebc
--- /dev/null
+++ b/.changes/macos-meta.md
@@ -0,0 +1,5 @@
+---
+"meilisearch-docsearch": "patch"
+---
+
+Fix Command+k not working on macOS devices.
diff --git a/src/useDocSearchHotKeys.ts b/src/useDocSearchHotKeys.ts
index b22796c..1227433 100644
--- a/src/useDocSearchHotKeys.ts
+++ b/src/useDocSearchHotKeys.ts
@@ -58,8 +58,9 @@ export function useDocSearchHotKeys({
modsAndkeys.some(isCtrl);
const shift = event.shiftKey == modsAndkeys.includes("shift");
const alt = event.altKey == modsAndkeys.some(isAlt);
- const meta =
- !isAppleDevice() && event.metaKey == modsAndkeys.some(isMeta);
+ const meta = isAppleDevice()
+ ? true
+ : event.metaKey == modsAndkeys.some(isMeta);
return ctrl && shift && alt && meta;
}