Skip to content

Commit

Permalink
Added support for passing through onKeyDown in KBarSearch component (
Browse files Browse the repository at this point in the history
…#189)

* Added support for passing through `onKeyDown` in KBarSearch component

* Move `props` spreading
  • Loading branch information
schickling authored Mar 23, 2022
1 parent 9c3e1e5 commit e9f877e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/KBarSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export function KBarSearch(

return (
<input
{...props}
ref={ownRef}
autoFocus
autoComplete="off"
Expand All @@ -58,12 +59,12 @@ export function KBarSearch(
options?.callbacks?.onQueryChange?.(event.target.value);
}}
onKeyDown={(event) => {
props.onKeyDown?.(event);
if (currentRootActionId && !search && event.key === "Backspace") {
const parent = actions[currentRootActionId].parent;
query.setCurrentRootAction(parent);
}
}}
{...props}
/>
);
}

1 comment on commit e9f877e

@vercel
Copy link

@vercel vercel bot commented on e9f877e Mar 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

Please sign in to comment.