1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

refactor: misc login page accessibility improvements (#914)

* refactor: add missing input field labels

* refactor: add missing className prop

* refactor: add missing image labels

* refactor: fix forgot password title size

* refactor fix StandaloneLayout page landmarks

* refactor: improve project page title

* refactor: add autoFocus to login fields
This commit is contained in:
olav 2022-04-27 09:29:43 +02:00 committed by GitHub
parent f7266cde10
commit 531d969fa6
10 changed files with 30 additions and 11 deletions

View File

@ -4,6 +4,7 @@ interface IGradientProps {
from: string; from: string;
to: string; to: string;
style?: object; style?: object;
className?: string;
} }
const Gradient: React.FC<IGradientProps> = ({ const Gradient: React.FC<IGradientProps> = ({

View File

@ -49,7 +49,7 @@ export const ProjectFeatureToggles = ({
headerContent={ headerContent={
<HeaderTitle <HeaderTitle
className={styles.title} className={styles.title}
title={`Project features (${filteredFeatures.length})`} title={`Project feature toggles (${filteredFeatures.length})`}
actions={ actions={
<div className={styles.actionsContainer}> <div className={styles.actionsContainer}>
<SearchField <SearchField

View File

@ -36,7 +36,7 @@ const DemoAuth = ({ authDetails, redirect }) => {
return ( return (
<form onSubmit={handleSubmit}> <form onSubmit={handleSubmit}>
<Logo className={styles.logo} /> <Logo className={styles.logo} aria-label="Unleash logo" />
<div className={styles.container}> <div className={styles.container}>
<h2>Access the Unleash demo instance</h2> <h2>Access the Unleash demo instance</h2>
<p>No further data or Credit Card required</p> <p>No further data or Credit Card required</p>
@ -50,6 +50,7 @@ const DemoAuth = ({ authDetails, redirect }) => {
variant="outlined" variant="outlined"
label="Email" label="Email"
name="email" name="email"
id="email"
data-testid={LOGIN_EMAIL_ID} data-testid={LOGIN_EMAIL_ID}
required required
type="email" type="email"

View File

@ -49,8 +49,7 @@ const ForgottenPassword = () => {
)} )}
ref={ref} ref={ref}
> >
<Typography <h2
variant="h2"
className={classnames( className={classnames(
commonStyles.title, commonStyles.title,
commonStyles.textCenter commonStyles.textCenter
@ -58,7 +57,7 @@ const ForgottenPassword = () => {
data-loading data-loading
> >
Forgotten password Forgotten password
</Typography> </h2>
<ConditionallyRender <ConditionallyRender
condition={attempted} condition={attempted}
show={ show={

View File

@ -102,6 +102,7 @@ const HostedAuth = ({ authDetails, redirect }) => {
<TextField <TextField
label="Username or email" label="Username or email"
name="username" name="username"
id="username"
type="string" type="string"
onChange={evt => setUsername(evt.target.value)} onChange={evt => setUsername(evt.target.value)}
value={username} value={username}
@ -115,6 +116,7 @@ const HostedAuth = ({ authDetails, redirect }) => {
label="Password" label="Password"
onChange={evt => setPassword(evt.target.value)} onChange={evt => setPassword(evt.target.value)}
name="password" name="password"
id="password"
value={password} value={password}
error={!!passwordError} error={!!passwordError}
helperText={passwordError} helperText={passwordError}

View File

@ -63,6 +63,8 @@ export const NewUser = () => {
<TextField <TextField
data-loading data-loading
value={data?.email || ''} value={data?.email || ''}
id="username"
label="Username"
variant="outlined" variant="outlined"
size="small" size="small"
className={styles.emailField} className={styles.emailField}

View File

@ -102,6 +102,7 @@ const PasswordAuth = ({ authDetails, redirect }) => {
<TextField <TextField
label="Username or email" label="Username or email"
name="username" name="username"
id="username"
type="string" type="string"
onChange={evt => setUsername(evt.target.value)} onChange={evt => setUsername(evt.target.value)}
value={username} value={username}
@ -111,11 +112,13 @@ const PasswordAuth = ({ authDetails, redirect }) => {
data-testid={LOGIN_EMAIL_ID} data-testid={LOGIN_EMAIL_ID}
variant="outlined" variant="outlined"
size="small" size="small"
autoFocus
/> />
<PasswordField <PasswordField
label="Password" label="Password"
onChange={evt => setPassword(evt.target.value)} onChange={evt => setPassword(evt.target.value)}
name="password" name="password"
id="password"
value={password} value={password}
error={!!passwordError} error={!!passwordError}
helperText={passwordError} helperText={passwordError}

View File

@ -56,9 +56,11 @@ const SimpleAuth = ({ authDetails, redirect }) => {
variant="outlined" variant="outlined"
label="Email" label="Email"
name="email" name="email"
id="email"
required required
type="email" type="email"
data-testid={LOGIN_EMAIL_ID} data-testid={LOGIN_EMAIL_ID}
autoFocus
/> />
<br /> <br />

View File

@ -20,7 +20,6 @@ const StandaloneBanner: FC<IStandaloneBannerProps> = ({ title, children }) => {
from={theme.palette.primary.main} from={theme.palette.primary.main}
// @ts-expect-error // @ts-expect-error
to={theme.palette.login.gradient.bottom} to={theme.palette.login.gradient.bottom}
// @ts-expect-error
className={styles.gradient} className={styles.gradient}
> >
<div className={styles.container}> <div className={styles.container}>
@ -35,8 +34,18 @@ const StandaloneBanner: FC<IStandaloneBannerProps> = ({ title, children }) => {
<div className={styles.logoContainer}> <div className={styles.logoContainer}>
<ConditionallyRender <ConditionallyRender
condition={smallScreen} condition={smallScreen}
show={<LogoWithText className={styles.logo} />} show={
elseShow={<Logo className={styles.logo} />} <LogoWithText
className={styles.logo}
aria-label="Unleash logo"
/>
}
elseShow={
<Logo
className={styles.logo}
aria-label="Unleash logo"
/>
}
/> />
</div> </div>
</Gradient> </Gradient>

View File

@ -21,10 +21,10 @@ const StandaloneLayout: FC<IStandaloneLayout> = ({
return ( return (
<div className={styles.container}> <div className={styles.container}>
<div className={styles.leftContainer}>{banner}</div> <header className={styles.leftContainer}>{banner}</header>
<div className={styles.rightContainer}> <main className={styles.rightContainer}>
<div className={styles.innerRightContainer}>{children}</div> <div className={styles.innerRightContainer}>{children}</div>
</div> </main>
</div> </div>
); );
}; };