Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions modules/ui/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ const DRAFT_URL = '/assets/icons/draft.svg';
const PILOT_URL = '/assets/icons/pilot.svg';
const QUALIFICATION_URL = '/assets/icons/qualification.svg';

const navKeys = [
'Tab',
'ArrowUp',
'ArrowDown',
'ArrowLeft',
'ArrowRight',
'Home',
'End',
'PageUp',
'PageDown',
'Escape',
'Enter',
];

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
Expand Down Expand Up @@ -143,9 +157,11 @@ export class AppComponent implements AfterViewInit {
this.renderer.addClass(document.body as HTMLElement, 'using-mouse');
}

@HostListener('keydown')
onKeydown() {
this.renderer.removeClass(document.body as HTMLElement, 'using-mouse');
@HostListener('keydown', ['$event'])
onKeydown(e: KeyboardEvent) {
if (navKeys.includes(e.key)) {
this.renderer.removeClass(document.body as HTMLElement, 'using-mouse');
}
}

navigateToRuntime = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,15 @@ export class ListLayoutComponent<T extends object> {
};

updateQuery(e: Event) {
const inputValue = (e.target as HTMLInputElement).value.trim();
const searchValue = inputValue.length > 2 ? inputValue : '';
this.searchText.set(searchValue);
const input = e.target as HTMLInputElement;
const value = input.value;
if (value.trim() === '') {
input.value = '';
} else {
const inputValue = value.trim();
const searchValue = inputValue.length > 2 ? inputValue : '';
this.searchText.set(searchValue);
}
}

filter(searchText: string) {
Expand Down