Autofocus support in InputBoxWrapper (#1340)

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
Daniel Valdivia
2021-12-23 09:10:10 -08:00
committed by GitHub
parent e51bde0fd2
commit b40ec520ae
5 changed files with 7 additions and 0 deletions

View File

@@ -290,6 +290,7 @@ const AddBucket = ({
<InputBoxWrapper
id="bucket-name"
name="bucket-name"
autoFocus={true}
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
addBucketName(event.target.value);
}}

View File

@@ -59,6 +59,7 @@ interface InputBoxProps {
extraInputProps?: StandardInputProps["inputProps"];
noLabelMinWidth?: boolean;
pattern?: string;
autoFocus?: boolean;
}
const styles = (theme: Theme) =>
@@ -123,6 +124,7 @@ const InputBoxWrapper = ({
overlayAction,
noLabelMinWidth = false,
pattern = "",
autoFocus = false,
classes,
}: InputBoxProps) => {
let inputProps: any = { "data-index": index, ...extraInputProps };
@@ -176,6 +178,7 @@ const InputBoxWrapper = ({
name={name}
fullWidth
value={value}
autoFocus={autoFocus}
disabled={disabled}
onChange={onChange}
type={type}

View File

@@ -206,6 +206,7 @@ const AddGroup = ({
id="group-name"
name="group-name"
label="Group Name"
autoFocus={true}
value={groupName}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
setGroupName(e.target.value);

View File

@@ -137,6 +137,7 @@ const AddPolicy = ({
name="policy-name"
label="Policy Name"
placeholder="Enter Policy Name"
autoFocus={true}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
setPolicyName(e.target.value);
}}

View File

@@ -212,6 +212,7 @@ const AddUser = ({
name="accesskey-input"
label="Access Key"
value={accessKey}
autoFocus={true}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
setAccessKey(e.target.value);
}}