Skip to content

Commit b183239

Browse files
chore: add autocomplete for inputs - name, phone, location (#24422)
* add autocomplete for inputs - name, phone, location * Addressed coderabits comments * autocomplete for email and url --------- Co-authored-by: Anik Dhabal Babu <[email protected]>
1 parent 013e614 commit b183239

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

packages/features/components/phone-input/PhoneInput.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ function BasePhoneInput({
6868
name,
6969
required: rest.required,
7070
placeholder: rest.placeholder,
71+
autoComplete: "tel",
7172
}}
7273
onChange={(val: string) => {
7374
onChange(`+${val}`);
@@ -118,6 +119,7 @@ function BasePhoneInputWeb({
118119
name,
119120
required: rest.required,
120121
placeholder: rest.placeholder,
122+
autoComplete: "tel",
121123
}}
122124
onChange={(val: string) => {
123125
onChange(`+${val}`);

packages/features/form-builder/Components.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export const Components: Record<FieldType, Component> = {
145145
value={value}
146146
required={variantField.required}
147147
type="text"
148+
autoComplete="name"
148149
onChange={(e) => {
149150
props.setValue(e.target.value);
150151
}}
@@ -174,6 +175,13 @@ export const Components: Record<FieldType, Component> = {
174175
value={value[variantField.name as keyof typeof value]}
175176
required={variantField.required}
176177
type="text"
178+
autoComplete={
179+
variantField.name === "firstName"
180+
? "given-name"
181+
: variantField.name === "lastName"
182+
? "family-name"
183+
: undefined
184+
}
177185
onChange={(e) => onChange(variantField.name, e.target.value)}
178186
/>
179187
))}
@@ -211,6 +219,7 @@ export const Components: Record<FieldType, Component> = {
211219
type="email"
212220
id={props.name}
213221
noLabel={true}
222+
autoComplete="email"
214223
{...props}
215224
onChange={(e) => props.setValue(e.target.value)}
216225
/>
@@ -543,7 +552,7 @@ export const Components: Record<FieldType, Component> = {
543552
url: {
544553
propsType: propsTypes.url,
545554
factory: (props) => {
546-
return <Widgets.TextWidget type="url" noLabel={true} {...props} />;
555+
return <Widgets.TextWidget type="url" autoComplete="url" noLabel={true} {...props} />;
547556
},
548557
},
549558
} as const;

packages/ui/components/address/AddressInput.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ function AddressInput({ value, onChange, ...rest }: AddressInputProps) {
2222
/>
2323
<Input
2424
{...rest}
25+
autoComplete="address-line1"
2526
value={value}
2627
onChange={(e) => {
2728
onChange(e.target.value);

0 commit comments

Comments
 (0)