From 9383609a2205b2c407ceb41fc01009eb0d816998 Mon Sep 17 00:00:00 2001 From: MokireddySampath <120497218+MokireddySampath@users.noreply.github.com> Date: Mon, 19 Dec 2022 12:41:08 +0530 Subject: [PATCH] keyboard navigation for defects 1722611,1722618 --- less/TableStyles/queryBuilder.less | 2 +- src/Common/TableEntity.tsx | 26 ++++++++++++++++--- .../ThroughputInputAutoPilotV3Component.tsx | 5 ++-- .../Panes/Tables/AddTableEntityPanel.tsx | 11 ++++++-- .../QueryBuilder/QueryBuilderViewModel.ts | 3 ++- src/Explorer/Tabs/QueryTablesTab.html | 26 ++++++++++++------- 6 files changed, 55 insertions(+), 18 deletions(-) diff --git a/less/TableStyles/queryBuilder.less b/less/TableStyles/queryBuilder.less index 2d2a1224e..23e9ac8c3 100644 --- a/less/TableStyles/queryBuilder.less +++ b/less/TableStyles/queryBuilder.less @@ -485,7 +485,7 @@ input::-webkit-inner-spin-button { } .entity-Add-Cancel { - padding: @DefaultSpace @SmallSpace @SmallSpace; + // padding: @DefaultSpace @SmallSpace @SmallSpace; cursor: pointer; } diff --git a/src/Common/TableEntity.tsx b/src/Common/TableEntity.tsx index 3a38f275e..dbf1f1b0a 100644 --- a/src/Common/TableEntity.tsx +++ b/src/Common/TableEntity.tsx @@ -7,7 +7,7 @@ import { IStackTokens, Stack, TextField, - TooltipHost, + TooltipHost } from "@fluentui/react"; import React, { FunctionComponent } from "react"; import DeleteIcon from "../../images/delete.svg"; @@ -72,6 +72,26 @@ export const TableEntity: FunctionComponent = ({ }; const sectionStackTokens: IStackTokens = { childrenGap: 12 }; + // const enterkeypress=(event:KeyboardEvent)=>{ + // if(event.key==='enter'){ + // onEditEntity(); + // } + // } + const handleKeyPress = (event: React.KeyboardEvent)=>{ + + + if(event.key=='Enter' || event.key === 'Space'){ + onEditEntity() + } + } + const handleKeyPressdelete = (event: React.KeyboardEvent)=>{ + + + if(event.key=='Enter' || event.key === 'Space'){ + onDeleteEntity() + } + } + const getEntityValueType = (): string => { const { Int, Smallint, Tinyint } = CassandraType; @@ -126,12 +146,12 @@ export const TableEntity: FunctionComponent = ({ /> {!isEntityValueDisable && ( - editEntity + editEntity )} {isDeleteOptionVisible && userContext.apiType !== "Cassandra" && ( - delete entity + delete entity )} diff --git a/src/Explorer/Controls/Settings/SettingsSubComponents/ThroughputInputComponents/ThroughputInputAutoPilotV3Component.tsx b/src/Explorer/Controls/Settings/SettingsSubComponents/ThroughputInputComponents/ThroughputInputAutoPilotV3Component.tsx index 2a508412d..017a05a00 100644 --- a/src/Explorer/Controls/Settings/SettingsSubComponents/ThroughputInputComponents/ThroughputInputAutoPilotV3Component.tsx +++ b/src/Explorer/Controls/Settings/SettingsSubComponents/ThroughputInputComponents/ThroughputInputAutoPilotV3Component.tsx @@ -9,7 +9,7 @@ import { MessageBar, Stack, Text, - TextField, + TextField } from "@fluentui/react"; import React from "react"; import * as DataModels from "../../../../../Contracts/DataModels"; @@ -38,7 +38,7 @@ import { PriceBreakdown, saveThroughputWarningMessage, titleAndInputStackProps, - transparentDetailsHeaderStyle, + transparentDetailsHeaderStyle } from "../../SettingsRenderUtils"; import { getSanitizedInputValue, IsComponentDirtyResult, isDirty } from "../../SettingsUtils"; import { ToolTipLabelComponent } from "../ToolTipLabelComponent"; @@ -574,6 +574,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component< styles={getTextFieldStyles(this.props.throughput, this.props.throughputBaseline)} disabled={this.overrideWithAutoPilotSettings()} step={this.step} + tabIndex={0} value={ this.overrideWithAutoPilotSettings() ? this.props.maxAutoPilotThroughputBaseline?.toString() diff --git a/src/Explorer/Panes/Tables/AddTableEntityPanel.tsx b/src/Explorer/Panes/Tables/AddTableEntityPanel.tsx index eafa4ae1b..6841235cc 100644 --- a/src/Explorer/Panes/Tables/AddTableEntityPanel.tsx +++ b/src/Explorer/Panes/Tables/AddTableEntityPanel.tsx @@ -31,7 +31,7 @@ import { getDefaultEntities, getEntityValuePlaceholder, imageProps, - options, + options } from "./Validators/EntityTableHelper"; interface AddTableEntityPanelProps { @@ -242,6 +242,13 @@ export const AddTableEntityPanel: FunctionComponent = submitButtonText: getButtonLabel(userContext.apiType), onSubmit, }; + const handlekeypressaddentity = (event: React.KeyboardEvent)=>{ + + console.log(event.key) + if(event.key=='Enter' || event.key=="Space"){ + addNewEntity() + } + } return ( @@ -284,7 +291,7 @@ export const AddTableEntityPanel: FunctionComponent = ); })} {userContext.apiType !== "Cassandra" && ( - + Add Entity {getAddButtonLabel(userContext.apiType)} diff --git a/src/Explorer/Tables/QueryBuilder/QueryBuilderViewModel.ts b/src/Explorer/Tables/QueryBuilder/QueryBuilderViewModel.ts index 61dd3fde3..fd767a5a9 100644 --- a/src/Explorer/Tables/QueryBuilder/QueryBuilderViewModel.ts +++ b/src/Explorer/Tables/QueryBuilder/QueryBuilderViewModel.ts @@ -504,6 +504,7 @@ export default class QueryBuilderViewModel { // adds a new clause to the end of the array public addNewClause = (): void => { this.addClauseIndex(this.clauseArray().length); + console.log('addnewcause') }; public onAddClauseKeyDown = (index: number, event: KeyboardEvent): boolean => { @@ -516,7 +517,7 @@ export default class QueryBuilderViewModel { }; public onAddNewClauseKeyDown = (event: KeyboardEvent): boolean => { - if (event.keyCode === KeyCodes.Enter || event.keyCode === KeyCodes.Space) { + if (event.key === 'Enter' || event.key === 'Space') { this.addClauseIndex(this.clauseArray().length - 1); event.stopPropagation(); return false; diff --git a/src/Explorer/Tabs/QueryTablesTab.html b/src/Explorer/Tabs/QueryTablesTab.html index 2a71c9682..a234c739f 100644 --- a/src/Explorer/Tabs/QueryTablesTab.html +++ b/src/Explorer/Tabs/QueryTablesTab.html @@ -70,11 +70,13 @@ + + @@ -168,22 +172,26 @@