Update view.jsx

Trying to action this issue: Pressing escape in wunderbar should do something useful #2116, I also added ctrl-K as a keyboard shortcut to bring the wunderbar into focus.
This commit is contained in:
ddifiore 2021-08-29 20:43:07 -04:00 committed by jessopb
parent 3b94ecaf80
commit f3fb413a03

View file

@ -228,12 +228,19 @@ export default function WunderBarSuggestions(props: Props) {
function handleKeyDown(event) {
const { ctrlKey, metaKey, keyCode } = event;
if (keyCode === K_KEY_CODE && ctrlKey) {
inputRef.current.focus();
inputRef.current.select();
return;
}
if (!inputRef.current) {
return;
}
if (inputRef.current === document.activeElement && keyCode === ESC_KEY_CODE) {
inputRef.current.blur();
inputRef.current.value = "";
inputRef.current.focus();
}
// @if TARGET='app'