You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/12/22 21:33:47 UTC

[GitHub] [druid] vogievetsky commented on a change in pull request #11947: [Web Console] fix deprecated keyboard event method "keyCode" with "key"

vogievetsky commented on a change in pull request #11947:
URL: https://github.com/apache/druid/pull/11947#discussion_r774190078



##########
File path: web-console/src/views/query-view/query-output/column-rename-input/column-rename-input.tsx
##########
@@ -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': // Enter

Review comment:
       Also now we do not need the comment. Yay for self documenting code.

##########
File path: web-console/src/bootstrap/react-table-custom-pagination.tsx
##########
@@ -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') {

Review comment:
       I think the correct string here is `'Enter'` not `'enter'`

##########
File path: web-console/src/views/query-view/query-output/column-rename-input/column-rename-input.tsx
##########
@@ -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': // Enter

Review comment:
       Ditto on the capitalization here and everywhere




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org