Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Let browsers autofill email and name fields

Matt Roberts41b935d1e9a6
diff --git a/public/components/common/SignInControl.tsx b/public/components/common/SignInControl.tsx
index 96fe22026..f6e39ccd6 100644
--- a/public/components/common/SignInControl.tsx
+++ b/public/components/common/SignInControl.tsx
@@ -198,7 +198,7 @@ export const SignInControl: React.FunctionComponent<SignInControlProps> = (props
{props.useEmail &&
(showEmailForm ? (
<div className="pt-3">
- <Form error={error} autoComplete={emailSignInStep === EmailSigninStep.EnterCode ? "on" : "off"} onSubmit={handleFormSubmit}>
+ <Form error={error} autoComplete="on" onSubmit={handleFormSubmit}>
{(emailSignInStep === EmailSigninStep.EnterEmail || emailSignInStep === EmailSigninStep.EnterName) && renderEmailField()}
{emailSignInStep === EmailSigninStep.EnterName && renderNameField()}
@@ -231,6 +231,7 @@ export const SignInControl: React.FunctionComponent<SignInControlProps> = (props
field="name"
value={userName}
autoFocus={!device.isTouch()}
+ autoComplete="name"
onChange={setUserName}
placeholder={i18n._({ id: "signin.name.placeholder", message: "Your name" })}
maxLength={100}
@@ -244,6 +245,7 @@ export const SignInControl: React.FunctionComponent<SignInControlProps> = (props
<Input
className="text-left"
field="email"
+ type="email"
value={email}
disabled={emailSignInStep === EmailSigninStep.EnterName}
autoFocus={!device.isTouch()}
diff --git a/public/components/common/form/Form.tsx b/public/components/common/form/Form.tsx
index 9a532207c..aff7563fc 100644
--- a/public/components/common/form/Form.tsx
+++ b/public/components/common/form/Form.tsx
@@ -55,7 +55,7 @@ export const Form: React.FunctionComponent<FormProps> = (props) => {
}
return (
- <form autoComplete={props.autoComplete || "off"} className={className} onSubmit={handleSubmit}>
+ <form autoComplete={props.autoComplete || "off"} noValidate className={className} onSubmit={handleSubmit}>
<DisplayError error={formError} />
<ValidationContext.Provider value={{ error: formError, clearError }}>{props.children}</ValidationContext.Provider>
</form>
diff --git a/public/components/common/form/Input.tsx b/public/components/common/form/Input.tsx
index 516bca7bd..f378ab9fa 100644
--- a/public/components/common/form/Input.tsx
+++ b/public/components/common/form/Input.tsx
@@ -12,6 +12,7 @@ interface InputProps {
field: string
label?: string
className?: string
+ type?: "text" | "email"
autoComplete?: string
autoFocus?: boolean
noTabFocus?: boolean
@@ -79,7 +80,8 @@ export const Input: React.FunctionComponent<InputProps> = (props) => {
"c-input--suffixed": !!suffix,
})}
id={`input-${props.field}`}
- type="text"
+ name={props.field}
+ type={props.type || "text"}
autoComplete={props.autoComplete}
inputMode={props.inputMode}
tabIndex={props.noTabFocus ? -1 : undefined}
diff --git a/public/pages/MySettings/MySettings.page.tsx b/public/pages/MySettings/MySettings.page.tsx
index aa273e47a..e52247388 100644
--- a/public/pages/MySettings/MySettings.page.tsx
+++ b/public/pages/MySettings/MySettings.page.tsx
@@ -144,6 +144,8 @@ export default class MySettingsPage extends React.Component<MySettingsPageProps,
<Input
label={i18n._({ id: "label.email", message: "Email" })}
field="email"
+ type="email"
+ autoComplete="email"
value={this.state.changingEmail ? this.state.newEmail : Fider.session.user.email}
maxLength={200}
disabled={!this.state.changingEmail}
diff --git a/public/pages/SignUp/SignUp.page.tsx b/public/pages/SignUp/SignUp.page.tsx
index dd801e893..165d0dc49 100644
--- a/public/pages/SignUp/SignUp.page.tsx
+++ b/public/pages/SignUp/SignUp.page.tsx
@@ -115,9 +115,9 @@ const SignUpPage = () => {
<p>We need to identify you to setup your new Fider account.</p>
<SignInControl useEmail={false} />
<Divider />
- <Form error={error}>
- <Input field="name" maxLength={100} onChange={setUserName} placeholder="Name" />
- <Input field="email" maxLength={200} onChange={setUserEmail} placeholder="Email" />
+ <Form error={error} autoComplete="on">
+ <Input field="name" autoComplete="name" maxLength={100} onChange={setUserName} placeholder="Name" />
+ <Input field="email" type="email" autoComplete="email" maxLength={200} onChange={setUserEmail} placeholder="Email" />
</Form>
</>
)}