Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add a11y labels to auth modal inputs #3207

Merged
merged 1 commit into from
Dec 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion js/src/forum/components/ForgotPasswordModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export default class ForgotPasswordModal<CustomAttrs extends IForgotPasswordModa
);
}

const emailLabel = extractText(app.translator.trans('core.forum.forgot_password.email_placeholder'));

return (
<div className="Modal-body">
<div className="Form Form--centered">
Expand All @@ -61,7 +63,8 @@ export default class ForgotPasswordModal<CustomAttrs extends IForgotPasswordModa
className="FormControl"
name="email"
type="email"
placeholder={extractText(app.translator.trans('core.forum.forgot_password.email_placeholder'))}
placeholder={emailLabel}
aria-label={emailLabel}
bidi={this.email}
disabled={this.loading}
/>
Expand Down
9 changes: 7 additions & 2 deletions js/src/forum/components/LogInModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,18 @@ export default class LogInModal<CustomAttrs extends ILoginModalAttrs = ILoginMod
fields() {
const items = new ItemList();

const identificationLabel = extractText(app.translator.trans('core.forum.log_in.username_or_email_placeholder'));
const passwordLabel = extractText(app.translator.trans('core.forum.log_in.password_placeholder'));

items.add(
'identification',
<div className="Form-group">
<input
className="FormControl"
name="identification"
type="text"
placeholder={extractText(app.translator.trans('core.forum.log_in.username_or_email_placeholder'))}
placeholder={identificationLabel}
aria-label={identificationLabel}
bidi={this.identification}
disabled={this.loading}
/>
Expand All @@ -80,7 +84,8 @@ export default class LogInModal<CustomAttrs extends ILoginModalAttrs = ILoginMod
name="password"
type="password"
autocomplete="current-password"
placeholder={extractText(app.translator.trans('core.forum.log_in.password_placeholder'))}
placeholder={passwordLabel}
aria-label={passwordLabel}
bidi={this.password}
disabled={this.loading}
/>
Expand Down
13 changes: 10 additions & 3 deletions js/src/forum/components/SignUpModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,19 @@ export default class SignUpModal<CustomAttrs extends ISignupModalAttrs = ISignup
fields() {
const items = new ItemList();

const usernameLabel = extractText(app.translator.trans('core.forum.sign_up.username_placeholder'));
const emailLabel = extractText(app.translator.trans('core.forum.sign_up.email_placeholder'));
const passwordLabel = extractText(app.translator.trans('core.forum.sign_up.password_placeholder'));

items.add(
'username',
<div className="Form-group">
<input
className="FormControl"
name="username"
type="text"
placeholder={extractText(app.translator.trans('core.forum.sign_up.username_placeholder'))}
placeholder={usernameLabel}
aria-label={usernameLabel}
bidi={this.username}
disabled={this.loading || this.isProvided('username')}
/>
Expand All @@ -90,7 +95,8 @@ export default class SignUpModal<CustomAttrs extends ISignupModalAttrs = ISignup
className="FormControl"
name="email"
type="email"
placeholder={extractText(app.translator.trans('core.forum.sign_up.email_placeholder'))}
placeholder={emailLabel}
aria-label={emailLabel}
bidi={this.email}
disabled={this.loading || this.isProvided('email')}
/>
Expand All @@ -107,7 +113,8 @@ export default class SignUpModal<CustomAttrs extends ISignupModalAttrs = ISignup
name="password"
type="password"
autocomplete="new-password"
placeholder={extractText(app.translator.trans('core.forum.sign_up.password_placeholder'))}
placeholder={passwordLabel}
aria-label={passwordLabel}
bidi={this.password}
disabled={this.loading}
/>
Expand Down