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:
parent
3b94ecaf80
commit
f3fb413a03
1 changed files with 8 additions and 1 deletions
|
@ -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'
|
||||
|
|
Loading…
Add table
Reference in a new issue