diff --git a/apps/red-ui/src/app/components/spotlight-search/spotlight-search.component.ts b/apps/red-ui/src/app/components/spotlight-search/spotlight-search.component.ts index 67cb666aa..c2d5799e1 100644 --- a/apps/red-ui/src/app/components/spotlight-search/spotlight-search.component.ts +++ b/apps/red-ui/src/app/components/spotlight-search/spotlight-search.component.ts @@ -37,7 +37,6 @@ export class SpotlightSearchComponent { @HostListener('document:keyup', ['$event']) handleKeyDown(event: KeyboardEvent) { - console.log(event); if (event.code === 'ArrowDown' && this._actions) { this._currentActionIdx++; return this._restoreFocusOnAction(this._currentActionIdx === this._actions.length); @@ -53,11 +52,13 @@ export class SpotlightSearchComponent { return; } + if (this._actions.find((_, index) => index === this._currentActionIdx)?.nativeElement === document.activeElement) { + let query = this.formGroup.get('query').value as string; + if (event.code === 'Backspace') query = query.substring(0, query.length - 1); + else if (event.key.length === 1) query = query + event.key; + this.formGroup.patchValue({ query: query }); + } document.getElementById('query').focus(); - let query = this.formGroup.get('query').value as string; - if (event.code === 'Backspace') query = query.substring(0, query.length - 1); - else if (event.key.length === 1) query = query + event.key; - this.formGroup.patchValue({ query: query }); } @debounce(50)