Fixes for keyboard navigation of add new clause,edit,remove property,insert filter line, remove filter line

This commit is contained in:
Sampath 2022-12-19 18:27:52 +05:30
parent 9383609a22
commit 990d86ffc6
6 changed files with 46 additions and 31 deletions

View File

@ -72,26 +72,17 @@ export const TableEntity: FunctionComponent<TableEntityProps> = ({
}; };
const sectionStackTokens: IStackTokens = { childrenGap: 12 }; const sectionStackTokens: IStackTokens = { childrenGap: 12 };
// const enterkeypress=(event:KeyboardEvent)=>{
// if(event.key==='enter'){
// onEditEntity();
// }
// }
const handleKeyPress = (event: React.KeyboardEvent<HTMLElement>) => { const handleKeyPress = (event: React.KeyboardEvent<HTMLElement>) => {
if (event.key === "Enter" || event.key === "Space") {
onEditEntity();
if(event.key=='Enter' || event.key === 'Space'){
onEditEntity()
}
} }
};
const handleKeyPressdelete = (event: React.KeyboardEvent<HTMLElement>) => { const handleKeyPressdelete = (event: React.KeyboardEvent<HTMLElement>) => {
if (event.key === "Enter" || event.key === "Space") {
onDeleteEntity();
if(event.key=='Enter' || event.key === 'Space'){
onDeleteEntity()
} }
} };
const getEntityValueType = (): string => { const getEntityValueType = (): string => {
const { Int, Smallint, Tinyint } = CassandraType; const { Int, Smallint, Tinyint } = CassandraType;
@ -146,12 +137,28 @@ export const TableEntity: FunctionComponent<TableEntityProps> = ({
/> />
{!isEntityValueDisable && ( {!isEntityValueDisable && (
<TooltipHost content="Edit property" id="editTooltip"> <TooltipHost content="Edit property" id="editTooltip">
<Image {...imageProps} src={EditIcon} alt="editEntity" id="editEntity" onClick={onEditEntity} tabIndex={0} onKeyPress={handleKeyPress}/> <Image
{...imageProps}
src={EditIcon}
alt="editEntity"
id="editEntity"
onClick={onEditEntity}
tabIndex={0}
onKeyPress={handleKeyPress}
/>
</TooltipHost> </TooltipHost>
)} )}
{isDeleteOptionVisible && userContext.apiType !== "Cassandra" && ( {isDeleteOptionVisible && userContext.apiType !== "Cassandra" && (
<TooltipHost content="Delete property" id="deleteTooltip"> <TooltipHost content="Delete property" id="deleteTooltip">
<Image {...imageProps} src={DeleteIcon} alt="delete entity" id="deleteEntity" onClick={onDeleteEntity} tabIndex={0} onKeyPress={handleKeyPressdelete} /> <Image
{...imageProps}
src={DeleteIcon}
alt="delete entity"
id="deleteEntity"
onClick={onDeleteEntity}
tabIndex={0}
onKeyPress={handleKeyPressdelete}
/>
</TooltipHost> </TooltipHost>
)} )}
</Stack> </Stack>

View File

@ -574,7 +574,6 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
styles={getTextFieldStyles(this.props.throughput, this.props.throughputBaseline)} styles={getTextFieldStyles(this.props.throughput, this.props.throughputBaseline)}
disabled={this.overrideWithAutoPilotSettings()} disabled={this.overrideWithAutoPilotSettings()}
step={this.step} step={this.step}
tabIndex={0}
value={ value={
this.overrideWithAutoPilotSettings() this.overrideWithAutoPilotSettings()
? this.props.maxAutoPilotThroughputBaseline?.toString() ? this.props.maxAutoPilotThroughputBaseline?.toString()

View File

@ -243,12 +243,10 @@ export const AddTableEntityPanel: FunctionComponent<AddTableEntityPanelProps> =
onSubmit, onSubmit,
}; };
const handlekeypressaddentity = (event: React.KeyboardEvent<HTMLElement>) => { const handlekeypressaddentity = (event: React.KeyboardEvent<HTMLElement>) => {
if (event.key === "Enter" || event.key === "Space") {
console.log(event.key) addNewEntity();
if(event.key=='Enter' || event.key=="Space"){
addNewEntity()
}
} }
};
return ( return (
<RightPaneForm {...props}> <RightPaneForm {...props}>
@ -291,7 +289,13 @@ export const AddTableEntityPanel: FunctionComponent<AddTableEntityPanelProps> =
); );
})} })}
{userContext.apiType !== "Cassandra" && ( {userContext.apiType !== "Cassandra" && (
<Stack horizontal onClick={addNewEntity} className="addButtonEntiy" tabIndex={0} onKeyPress={handlekeypressaddentity}> <Stack
horizontal
onClick={addNewEntity}
className="addButtonEntiy"
tabIndex={0}
onKeyPress={handlekeypressaddentity}
>
<Image {...imageProps} src={AddPropertyIcon} alt="Add Entity" /> <Image {...imageProps} src={AddPropertyIcon} alt="Add Entity" />
<Text className="addNewParamStyle">{getAddButtonLabel(userContext.apiType)}</Text> <Text className="addNewParamStyle">{getAddButtonLabel(userContext.apiType)}</Text>
</Stack> </Stack>

View File

@ -29,10 +29,14 @@ exports[`Excute Add Table Entity Pane should render Default properly 1`] = `
className="addButtonEntiy" className="addButtonEntiy"
horizontal={true} horizontal={true}
onClick={[Function]} onClick={[Function]}
onKeyPress={[Function]}
tabIndex={0}
> >
<div <div
className="ms-Stack addButtonEntiy css-53" className="ms-Stack addButtonEntiy css-53"
onClick={[Function]} onClick={[Function]}
onKeyPress={[Function]}
tabIndex={0}
> >
<StyledImageBase <StyledImageBase
alt="Add Entity" alt="Add Entity"

View File

@ -242,7 +242,9 @@ exports[`AddCollectionPanel should render Default properly 1`] = `
Unique keys Unique keys
</Text> </Text>
<StyledTooltipHostBase <StyledTooltipHostBase
content="Unique keys provide developers with the ability to add a layer of data integrity to their database. By creating a unique key policy when a container is created, you ensure the uniqueness of one or more values per partition key." content="Unique keys provide developers with the ability to add a layer of data integrity to their database. By
creating a unique key policy when a container is created, you ensure the uniqueness of one or more values
per partition key."
directionalHint={4} directionalHint={4}
> >
<Icon <Icon

View File

@ -504,7 +504,6 @@ export default class QueryBuilderViewModel {
// adds a new clause to the end of the array // adds a new clause to the end of the array
public addNewClause = (): void => { public addNewClause = (): void => {
this.addClauseIndex(this.clauseArray().length); this.addClauseIndex(this.clauseArray().length);
console.log('addnewcause')
}; };
public onAddClauseKeyDown = (index: number, event: KeyboardEvent): boolean => { public onAddClauseKeyDown = (index: number, event: KeyboardEvent): boolean => {
@ -517,7 +516,7 @@ export default class QueryBuilderViewModel {
}; };
public onAddNewClauseKeyDown = (event: KeyboardEvent): boolean => { public onAddNewClauseKeyDown = (event: KeyboardEvent): boolean => {
if (event.key === 'Enter' || event.key === 'Space') { if (event.key === "Enter" || event.key === "Space") {
this.addClauseIndex(this.clauseArray().length - 1); this.addClauseIndex(this.clauseArray().length - 1);
event.stopPropagation(); event.stopPropagation();
return false; return false;