From ab175e2b03d6b5fe617a04607f6930c6c81e1ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Tron=C3=AD=C4=8Dek?= Date: Thu, 25 Aug 2022 12:51:57 +0000 Subject: [PATCH] Use `.key` instead of `.keyCode` / `.charCode`for keyboard events --- pkg/webui/src/JobList.tsx | 4 ++-- pkg/webui/src/JobView.tsx | 4 ++-- pkg/webui/src/StartJob.tsx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/webui/src/JobList.tsx b/pkg/webui/src/JobList.tsx index 26716d8..7f73ffe 100644 --- a/pkg/webui/src/JobList.tsx +++ b/pkg/webui/src/JobList.tsx @@ -300,8 +300,8 @@ class JobListImpl extends React.Component { } protected handleSearchKeyPress(evt: KeyboardEvent) { - if (evt.charCode !== 13) { - return + if (evt.key !== "Enter") { + return; } window.location.href = "/jobs/" + (evt.target as HTMLInputElement).value; diff --git a/pkg/webui/src/JobView.tsx b/pkg/webui/src/JobView.tsx index 4d64166..210549b 100644 --- a/pkg/webui/src/JobView.tsx +++ b/pkg/webui/src/JobView.tsx @@ -498,8 +498,8 @@ class JobViewImpl extends React.Component { } function returnToJobList(this: Window, evt: KeyboardEvent): any { - if (evt.keyCode !== 27) { - return + if (evt.key !== "Escape") { + return; } evt.preventDefault(); diff --git a/pkg/webui/src/StartJob.tsx b/pkg/webui/src/StartJob.tsx index 6597da7..403d89b 100644 --- a/pkg/webui/src/StartJob.tsx +++ b/pkg/webui/src/StartJob.tsx @@ -219,8 +219,8 @@ class StartJobImpl extends React.Component { } protected handleSearchKeyPress(evt: KeyboardEvent) { - if (evt.charCode !== 13) { - return + if (evt.key !== "Enter") { + return; } window.location.href = "/jobs/" + (evt.target as HTMLInputElement).value;