mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
docs: support CTRL+K to trigger docs search
This commit is contained in:
parent
c93be373ea
commit
ac38e9d353
1 changed files with 6 additions and 1 deletions
|
@ -74,7 +74,12 @@
|
|||
// Exit early if an inputtable element is already focused.
|
||||
return;
|
||||
}
|
||||
if ((e.metaKey && e.key === 'k') || e.key === '/') {
|
||||
|
||||
const isCommandOrControl = e.metaKey || e.ctrlKey;
|
||||
const isCmdK = isCommandOrControl && e.key.toLowerCase() === 'k';
|
||||
const isSlash = e.key === '/';
|
||||
|
||||
if (isCmdK || isSlash) {
|
||||
e.preventDefault();
|
||||
active = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue