Skip to content

Commit b40ec52

Browse files
authored
Autofocus support in InputBoxWrapper (#1340)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
1 parent e51bde0 commit b40ec52

File tree

5 files changed

+7
-0
lines changed

5 files changed

+7
-0
lines changed

portal-ui/src/screens/Console/Buckets/ListBuckets/AddBucket.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ const AddBucket = ({
290290
<InputBoxWrapper
291291
id="bucket-name"
292292
name="bucket-name"
293+
autoFocus={true}
293294
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
294295
addBucketName(event.target.value);
295296
}}

portal-ui/src/screens/Console/Common/FormComponents/InputBoxWrapper/InputBoxWrapper.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ interface InputBoxProps {
5959
extraInputProps?: StandardInputProps["inputProps"];
6060
noLabelMinWidth?: boolean;
6161
pattern?: string;
62+
autoFocus?: boolean;
6263
}
6364

6465
const styles = (theme: Theme) =>
@@ -123,6 +124,7 @@ const InputBoxWrapper = ({
123124
overlayAction,
124125
noLabelMinWidth = false,
125126
pattern = "",
127+
autoFocus = false,
126128
classes,
127129
}: InputBoxProps) => {
128130
let inputProps: any = { "data-index": index, ...extraInputProps };
@@ -176,6 +178,7 @@ const InputBoxWrapper = ({
176178
name={name}
177179
fullWidth
178180
value={value}
181+
autoFocus={autoFocus}
179182
disabled={disabled}
180183
onChange={onChange}
181184
type={type}

portal-ui/src/screens/Console/Groups/AddGroup.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ const AddGroup = ({
206206
id="group-name"
207207
name="group-name"
208208
label="Group Name"
209+
autoFocus={true}
209210
value={groupName}
210211
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
211212
setGroupName(e.target.value);

portal-ui/src/screens/Console/Policies/AddPolicy.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ const AddPolicy = ({
137137
name="policy-name"
138138
label="Policy Name"
139139
placeholder="Enter Policy Name"
140+
autoFocus={true}
140141
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
141142
setPolicyName(e.target.value);
142143
}}

portal-ui/src/screens/Console/Users/AddUser.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ const AddUser = ({
212212
name="accesskey-input"
213213
label="Access Key"
214214
value={accessKey}
215+
autoFocus={true}
215216
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
216217
setAccessKey(e.target.value);
217218
}}

0 commit comments

Comments
 (0)