From 52d00ecc727ccb8bf9a14aaab896558b9da7a14a Mon Sep 17 00:00:00 2001 From: Rishabh Date: Wed, 6 Jul 2022 15:52:33 +0200 Subject: [PATCH] Fixed keyboard shortcut for opening search refs https://github.com/TryGhost/Team/issues/1665 - fix browser hijack of cmd/ctrl + k shortcut for search --- ghost/sodo-search/src/App.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ghost/sodo-search/src/App.js b/ghost/sodo-search/src/App.js index 90fcb414ab..4fa9b3d2d3 100644 --- a/ghost/sodo-search/src/App.js +++ b/ghost/sodo-search/src/App.js @@ -63,10 +63,12 @@ export default class App extends React.Component { addKeyboardShortcuts() { this.handleKeyDown = (e) => { - if (e.keyCode === 75 && e.metaKey) { + if (e.key === 'k' && e.metaKey) { this.setState({ showPopup: true }); + e.preventDefault(); + e.stopPropagation(); return false; } };