Skip to content

Commit

Permalink
Fix Typescript linting errors
Browse files Browse the repository at this point in the history
Refs: #6567
  • Loading branch information
anicyne committed Aug 5, 2024
1 parent 232d574 commit 1d07334
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/components/src/components/table-stateless/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
TableStatelessStates,
} from '../../schema';
import {
Log,
validateLabel,
validateTableCallbacks,
validateTableData,
Expand Down Expand Up @@ -139,7 +140,7 @@ export class KolTableStateless implements TableStatelessAPI {
}

@Listen('keydown')
public handleKeyDown(event: KeyboardEvent) {
public async handleKeyDown(event: KeyboardEvent) {
if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
const focusedElement = this.tableDivElement?.querySelector(':focus') as HTMLKolInputCheckboxElement;
let index = this.checkboxRefs.indexOf(focusedElement);
Expand All @@ -148,11 +149,19 @@ export class KolTableStateless implements TableStatelessAPI {
if (event.key === 'ArrowDown') {
event.preventDefault();
index = (index + 1) % this.checkboxRefs.length;
this.checkboxRefs[index].focus();
try {
await this.checkboxRefs[index].focus();
} catch (e) {
Log.debug(e);
}
} else if (event.key === 'ArrowUp') {
event.preventDefault();
index = (index - 1) % this.checkboxRefs.length;
this.checkboxRefs[index].focus();
try {
await this.checkboxRefs[index].focus();
} catch (e) {
Log.debug(e);
}
}
}
}
Expand Down

0 comments on commit 1d07334

Please sign in to comment.