From ce2abb97e02bbcdbf014faeb3f39b8426b2c73a0 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Wed, 10 Aug 2022 16:28:39 -0400 Subject: [PATCH] accept cmd+k for search --- docs/assets/plugins/search/search.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/assets/plugins/search/search.js b/docs/assets/plugins/search/search.js index d8ec37b1..1d25c268 100644 --- a/docs/assets/plugins/search/search.js +++ b/docs/assets/plugins/search/search.js @@ -300,9 +300,12 @@ // Show the search panel slash is pressed outside of a form element document.addEventListener('keydown', event => { + const isSlash = event.key === '/'; + const isCtrlK = (event.metaKey || event.ctrlKey) && event.key === 'k'; + if ( !isShowing && - event.key === '/' && + (isSlash || isCtrlK) && !event.composedPath().some(el => ['input', 'textarea'].includes(el?.tagName?.toLowerCase())) ) { event.preventDefault();