[Web Console] fix deprecated keyboard event method "keyCode" with "key" (#11947)

* 11946 fix keyboard event keyCode method

* fix with key and respective cases

* e.which method required since it's anyway deprecated too.

* updated as per feedback
This commit is contained in:
AshishKapoor 2022-02-03 07:56:21 +05:30 committed by GitHub
parent f47e1e0dcc
commit 801d9e7f1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -123,7 +123,7 @@ export class ReactTableCustomPagination extends React.PureComponent<
value={tempPage || String(page + 1)}
onBlur={this.applyTempPage}
onKeyPress={e => {
if (e.which === 13 || e.keyCode === 13) {
if (e.key === 'Enter') {
this.applyTempPage(e);
}
}}

View File

@ -108,7 +108,7 @@ ReactDOM.render(
let mode: 'mouse' | 'tab' = 'mouse';
function handleTab(e: KeyboardEvent) {
if (e.keyCode !== 9) return;
if (e.key !== 'Tab') return;
if (mode === 'tab') return;
mode = 'tab';
document.body.classList.remove('mouse-mode');

View File

@ -44,12 +44,12 @@ export const ColumnRenameInput = React.memo(function ColumnRenameInput(
value={newName}
onChange={(e: any) => setNewName(e.target.value)}
onKeyDown={(e: React.KeyboardEvent<HTMLInputElement>) => {
switch (e.keyCode) {
case 13: // Enter
switch (e.key) {
case 'Enter':
maybeDone();
break;
case 27: // Esc
case 'Escape':
onDone();
break;
}