Skip to content

Commit

Permalink
Use .key instead of .keyCode / .charCodefor keyboard events
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptronicek authored and csweichel committed Aug 26, 2022
1 parent da8909e commit ab175e2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/webui/src/JobList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ class JobListImpl extends React.Component<JobListProps, JobListState> {
}

protected handleSearchKeyPress(evt: KeyboardEvent) {
if (evt.charCode !== 13) {
return
if (evt.key !== "Enter") {
return;
}

window.location.href = "/jobs/" + (evt.target as HTMLInputElement).value;
Expand Down
4 changes: 2 additions & 2 deletions pkg/webui/src/JobView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,8 @@ class JobViewImpl extends React.Component<JobViewProps, JobViewState> {
}

function returnToJobList(this: Window, evt: KeyboardEvent): any {
if (evt.keyCode !== 27) {
return
if (evt.key !== "Escape") {
return;
}

evt.preventDefault();
Expand Down
4 changes: 2 additions & 2 deletions pkg/webui/src/StartJob.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ class StartJobImpl extends React.Component<StartJobProps, StartJobState> {
}

protected handleSearchKeyPress(evt: KeyboardEvent) {
if (evt.charCode !== 13) {
return
if (evt.key !== "Enter") {
return;
}

window.location.href = "/jobs/" + (evt.target as HTMLInputElement).value;
Expand Down

0 comments on commit ab175e2

Please sign in to comment.