From 531d969fa6244782842698899b242f72ec62d26c Mon Sep 17 00:00:00 2001 From: olav Date: Wed, 27 Apr 2022 09:29:43 +0200 Subject: [PATCH] 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 --- .../src/component/common/Gradient/Gradient.tsx | 1 + .../ProjectFeatureToggles.tsx | 2 +- frontend/src/component/user/DemoAuth/DemoAuth.jsx | 3 ++- .../user/ForgottenPassword/ForgottenPassword.tsx | 5 ++--- .../src/component/user/HostedAuth/HostedAuth.jsx | 2 ++ frontend/src/component/user/NewUser/NewUser.tsx | 2 ++ .../component/user/PasswordAuth/PasswordAuth.jsx | 3 +++ .../src/component/user/SimpleAuth/SimpleAuth.jsx | 2 ++ .../user/StandaloneBanner/StandaloneBanner.tsx | 15 ++++++++++++--- .../common/StandaloneLayout/StandaloneLayout.tsx | 6 +++--- 10 files changed, 30 insertions(+), 11 deletions(-) diff --git a/frontend/src/component/common/Gradient/Gradient.tsx b/frontend/src/component/common/Gradient/Gradient.tsx index a660d5fb42..4de131d677 100644 --- a/frontend/src/component/common/Gradient/Gradient.tsx +++ b/frontend/src/component/common/Gradient/Gradient.tsx @@ -4,6 +4,7 @@ interface IGradientProps { from: string; to: string; style?: object; + className?: string; } const Gradient: React.FC = ({ diff --git a/frontend/src/component/project/Project/ProjectFeatureToggles/ProjectFeatureToggles.tsx b/frontend/src/component/project/Project/ProjectFeatureToggles/ProjectFeatureToggles.tsx index 400495065f..155d469324 100644 --- a/frontend/src/component/project/Project/ProjectFeatureToggles/ProjectFeatureToggles.tsx +++ b/frontend/src/component/project/Project/ProjectFeatureToggles/ProjectFeatureToggles.tsx @@ -49,7 +49,7 @@ export const ProjectFeatureToggles = ({ headerContent={ { return (
- +

Access the Unleash demo instance

No further data or Credit Card required

@@ -50,6 +50,7 @@ const DemoAuth = ({ authDetails, redirect }) => { variant="outlined" label="Email" name="email" + id="email" data-testid={LOGIN_EMAIL_ID} required type="email" diff --git a/frontend/src/component/user/ForgottenPassword/ForgottenPassword.tsx b/frontend/src/component/user/ForgottenPassword/ForgottenPassword.tsx index cb53a28148..6b9b97119d 100644 --- a/frontend/src/component/user/ForgottenPassword/ForgottenPassword.tsx +++ b/frontend/src/component/user/ForgottenPassword/ForgottenPassword.tsx @@ -49,8 +49,7 @@ const ForgottenPassword = () => { )} ref={ref} > - { data-loading > Forgotten password - + { setUsername(evt.target.value)} value={username} @@ -115,6 +116,7 @@ const HostedAuth = ({ authDetails, redirect }) => { label="Password" onChange={evt => setPassword(evt.target.value)} name="password" + id="password" value={password} error={!!passwordError} helperText={passwordError} diff --git a/frontend/src/component/user/NewUser/NewUser.tsx b/frontend/src/component/user/NewUser/NewUser.tsx index acaf555dce..82770e4272 100644 --- a/frontend/src/component/user/NewUser/NewUser.tsx +++ b/frontend/src/component/user/NewUser/NewUser.tsx @@ -63,6 +63,8 @@ export const NewUser = () => { { setUsername(evt.target.value)} value={username} @@ -111,11 +112,13 @@ const PasswordAuth = ({ authDetails, redirect }) => { data-testid={LOGIN_EMAIL_ID} variant="outlined" size="small" + autoFocus /> setPassword(evt.target.value)} name="password" + id="password" value={password} error={!!passwordError} helperText={passwordError} diff --git a/frontend/src/component/user/SimpleAuth/SimpleAuth.jsx b/frontend/src/component/user/SimpleAuth/SimpleAuth.jsx index 4ab2d6e681..f09aed537b 100644 --- a/frontend/src/component/user/SimpleAuth/SimpleAuth.jsx +++ b/frontend/src/component/user/SimpleAuth/SimpleAuth.jsx @@ -56,9 +56,11 @@ const SimpleAuth = ({ authDetails, redirect }) => { variant="outlined" label="Email" name="email" + id="email" required type="email" data-testid={LOGIN_EMAIL_ID} + autoFocus />
diff --git a/frontend/src/component/user/StandaloneBanner/StandaloneBanner.tsx b/frontend/src/component/user/StandaloneBanner/StandaloneBanner.tsx index 1ec51c2c03..b7cd782067 100644 --- a/frontend/src/component/user/StandaloneBanner/StandaloneBanner.tsx +++ b/frontend/src/component/user/StandaloneBanner/StandaloneBanner.tsx @@ -20,7 +20,6 @@ const StandaloneBanner: FC = ({ title, children }) => { from={theme.palette.primary.main} // @ts-expect-error to={theme.palette.login.gradient.bottom} - // @ts-expect-error className={styles.gradient} >
@@ -35,8 +34,18 @@ const StandaloneBanner: FC = ({ title, children }) => {
} - elseShow={} + show={ + + } + elseShow={ + + } />
diff --git a/frontend/src/component/user/common/StandaloneLayout/StandaloneLayout.tsx b/frontend/src/component/user/common/StandaloneLayout/StandaloneLayout.tsx index 39255b668a..c8156ae756 100644 --- a/frontend/src/component/user/common/StandaloneLayout/StandaloneLayout.tsx +++ b/frontend/src/component/user/common/StandaloneLayout/StandaloneLayout.tsx @@ -21,10 +21,10 @@ const StandaloneLayout: FC = ({ return (
-
{banner}
-
+
{banner}
+
{children}
-
+
); };