From 74deaad0b99edaa77d7303555c8ff1d6cdca7a1f Mon Sep 17 00:00:00 2001 From: Agnieszka Gancarczyk Date: Mon, 12 Jul 2021 15:09:14 +0100 Subject: [PATCH] added acessibility fixes --- src/client-scopes/details/ScopeForm.tsx | 20 ++++++------- src/clients/AdvancedTab.tsx | 4 +-- src/clients/advanced/AdvancedSettings.tsx | 10 +++---- .../advanced/AuthenticationOverrides.tsx | 4 +-- .../OpenIdConnectCompatibilityModes.tsx | 4 +-- src/clients/keys/Keys.tsx | 4 +-- src/components/scroll-form/FormPanel.tsx | 2 +- src/components/time-selector/TimeSelector.tsx | 1 + src/groups/GroupsModal.tsx | 1 + .../icons/FontAwesomeIcon.tsx | 8 +++--- src/realm-roles/RealmRoleForm.tsx | 1 + src/realm-settings/EmailTab.tsx | 10 +++---- src/realm-settings/GeneralTab.tsx | 8 +++--- src/realm-settings/LoginTab.tsx | 28 +++++++++---------- .../event-config/EventConfigForm.tsx | 8 +++--- src/realm-settings/event-config/EventsTab.tsx | 2 +- src/user/UserForm.tsx | 8 +++--- 17 files changed, 63 insertions(+), 60 deletions(-) diff --git a/src/client-scopes/details/ScopeForm.tsx b/src/client-scopes/details/ScopeForm.tsx index 01b931ba5e..06a79a4c62 100644 --- a/src/client-scopes/details/ScopeForm.tsx +++ b/src/client-scopes/details/ScopeForm.tsx @@ -70,7 +70,7 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => { id="name-help-icon" helpText="client-scopes-help:name" forLabel={t("common:name")} - forID="kc-name" + forID={t(`common:helpLabel`, { label: t("common:name") })} /> } fieldId="kc-name" @@ -96,7 +96,7 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => { } fieldId="kc-description" @@ -125,7 +125,7 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => { } fieldId="type" @@ -158,7 +158,7 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => { } fieldId="kc-protocol" @@ -200,7 +200,7 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => { } fieldId="kc-display.on.consent.screen" @@ -211,7 +211,7 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => { defaultValue="true" render={({ onChange, value }) => ( { } fieldId="kc-consent-screen-text" @@ -247,7 +247,7 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => { } fieldId="includeInTokenScope" @@ -258,7 +258,7 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => { defaultValue="true" render={({ onChange, value }) => ( { } fieldId="kc-gui-order" diff --git a/src/clients/AdvancedTab.tsx b/src/clients/AdvancedTab.tsx index 4af4c03e1c..c2b1a39acf 100644 --- a/src/clients/AdvancedTab.tsx +++ b/src/clients/AdvancedTab.tsx @@ -198,7 +198,7 @@ export const AdvancedTab = ({ } > @@ -244,7 +244,7 @@ export const AdvancedTab = ({ } > diff --git a/src/clients/advanced/AdvancedSettings.tsx b/src/clients/advanced/AdvancedSettings.tsx index 42869a2bfb..b3a80ebeab 100644 --- a/src/clients/advanced/AdvancedSettings.tsx +++ b/src/clients/advanced/AdvancedSettings.tsx @@ -40,7 +40,7 @@ export const AdvancedSettings = ({ } > @@ -67,7 +67,7 @@ export const AdvancedSettings = ({ } > @@ -93,7 +93,7 @@ export const AdvancedSettings = ({ } > @@ -103,7 +103,7 @@ export const AdvancedSettings = ({ control={control} render={({ onChange, value }) => ( } > diff --git a/src/clients/advanced/AuthenticationOverrides.tsx b/src/clients/advanced/AuthenticationOverrides.tsx index 4439cb8869..d93e8a0ae3 100644 --- a/src/clients/advanced/AuthenticationOverrides.tsx +++ b/src/clients/advanced/AuthenticationOverrides.tsx @@ -64,7 +64,7 @@ export const AuthenticationOverrides = ({ } > @@ -97,7 +97,7 @@ export const AuthenticationOverrides = ({ } > diff --git a/src/clients/advanced/OpenIdConnectCompatibilityModes.tsx b/src/clients/advanced/OpenIdConnectCompatibilityModes.tsx index 7a577ef768..c2f95a4f8b 100644 --- a/src/clients/advanced/OpenIdConnectCompatibilityModes.tsx +++ b/src/clients/advanced/OpenIdConnectCompatibilityModes.tsx @@ -27,7 +27,7 @@ export const OpenIdConnectCompatibilityModes = ({ } > @@ -37,7 +37,7 @@ export const OpenIdConnectCompatibilityModes = ({ control={control} render={({ onChange, value }) => ( { } > @@ -154,7 +154,7 @@ export const Keys = ({ clientId, save }: KeysProps) => { render={({ onChange, value }) => ( { diff --git a/src/groups/GroupsModal.tsx b/src/groups/GroupsModal.tsx index 7255a55c01..67e3aa07a0 100644 --- a/src/groups/GroupsModal.tsx +++ b/src/groups/GroupsModal.tsx @@ -99,6 +99,7 @@ export const GroupsModal = ({ > <TextInput data-testid="groupNameInput" + aria-label="group name input" ref={register({ required: true })} autoFocus type="text" diff --git a/src/identity-providers/icons/FontAwesomeIcon.tsx b/src/identity-providers/icons/FontAwesomeIcon.tsx index d0f6d45dd2..b8dd275247 100644 --- a/src/identity-providers/icons/FontAwesomeIcon.tsx +++ b/src/identity-providers/icons/FontAwesomeIcon.tsx @@ -11,13 +11,13 @@ export const FontAwesomeIcon = ({ icon }: FontAwesomeIconProps) => { const styles = { style: { height: "2em", width: "2em" } }; switch (icon) { case "bitbucket": - return <img src={bitbucketIcon} {...styles} />; + return <img src={bitbucketIcon} {...styles} aria-label="bitbucket icon"/>; case "microsoft": - return <img src={microsoftIcon} {...styles} />; + return <img src={microsoftIcon} {...styles} aria-label="microsoft icon"/>; case "instagram": - return <img src={instagramIcon} {...styles} />; + return <img src={instagramIcon} {...styles} aria-label="instagram icon"/>; case "paypal": - return <img src={paypalIcon} {...styles} />; + return <img src={paypalIcon} {...styles} aria-label="paypal icon"/>; default: return <></>; } diff --git a/src/realm-roles/RealmRoleForm.tsx b/src/realm-roles/RealmRoleForm.tsx index 3bced5fdec..1bac3d9e80 100644 --- a/src/realm-roles/RealmRoleForm.tsx +++ b/src/realm-roles/RealmRoleForm.tsx @@ -59,6 +59,7 @@ export const RealmRoleForm = ({ > <TextArea name="description" + aria-label="description" isDisabled={getValues().name?.includes("default-roles")} ref={register({ maxLength: { diff --git a/src/realm-settings/EmailTab.tsx b/src/realm-settings/EmailTab.tsx index 932f12ffea..fcefbc1d0f 100644 --- a/src/realm-settings/EmailTab.tsx +++ b/src/realm-settings/EmailTab.tsx @@ -180,7 +180,7 @@ export const RealmSettingsEmailTab = ({ <HelpItem helpText="realm-settings-help:fromDisplayName" forLabel={t("authentication")} - forID="kc-user-manged-access" + forID={t(`common:helpLabel`, { label: t("authentication") })} /> } > @@ -217,7 +217,7 @@ export const RealmSettingsEmailTab = ({ <HelpItem helpText="realm-settings-help:replyToDisplayName" forLabel={t("replyToDisplayName")} - forID="kc-user-manged-access" + forID={t(`common:helpLabel`, { label: t("replyToDisplayName") })} /> } > @@ -236,7 +236,7 @@ export const RealmSettingsEmailTab = ({ <HelpItem helpText="realm-settings-help:envelopeFrom" forLabel={t("envelopeFrom")} - forID="kc-envelope-from" + forID={t(`common:helpLabel`, { label: t("envelopeFrom") })} /> } > @@ -328,7 +328,7 @@ export const RealmSettingsEmailTab = ({ defaultValue={authenticationEnabled} render={({ onChange, value }) => ( <Switch - id="kc-authentication" + id="kc-authentication-switch" data-testid="email-authentication-switch" label={t("common:enabled")} labelOff={t("common:disabled")} @@ -369,7 +369,7 @@ export const RealmSettingsEmailTab = ({ <HelpItem helpText="realm-settings-help:password" forLabel={t("password")} - forID="kc-password" + forID={t(`common:helpLabel`, { label: t("password") })} /> } > diff --git a/src/realm-settings/GeneralTab.tsx b/src/realm-settings/GeneralTab.tsx index 0d4d53b9d0..a55ee2a1c7 100644 --- a/src/realm-settings/GeneralTab.tsx +++ b/src/realm-settings/GeneralTab.tsx @@ -86,7 +86,7 @@ export const RealmSettingsGeneralTab = ({ <HelpItem helpText="realm-settings-help:frontendUrl" forLabel={t("frontendUrl")} - forID="kc-frontend-url" + forID={t(`common:helpLabel`, { label: t("frontendUrl") })} /> } > @@ -104,7 +104,7 @@ export const RealmSettingsGeneralTab = ({ <HelpItem helpText="realm-settings-help:requireSsl" forLabel={t("requireSsl")} - forID="kc-require-ssl" + forID={t(`common:helpLabel`, { label: t("requireSsl") })} /> } > @@ -145,7 +145,7 @@ export const RealmSettingsGeneralTab = ({ <HelpItem helpText="realm-settings-help:userManagedAccess" forLabel={t("userManagedAccess")} - forID="kc-user-manged-access" + forID={t(`common:helpLabel`, { label: t("userManagedAccess") })} /> } fieldId="kc-user-manged-access" @@ -172,7 +172,7 @@ export const RealmSettingsGeneralTab = ({ <HelpItem helpText="realm-settings-help:endpoints" forLabel={t("endpoints")} - forID="kc-endpoints" + forID={t(`common:helpLabel`, { label: t("endpoints") })} /> } fieldId="kc-endpoints" diff --git a/src/realm-settings/LoginTab.tsx b/src/realm-settings/LoginTab.tsx index bcf28c3ad3..d8368102ae 100644 --- a/src/realm-settings/LoginTab.tsx +++ b/src/realm-settings/LoginTab.tsx @@ -32,13 +32,13 @@ export const RealmSettingsLoginTab = ({ <HelpItem helpText={t("userRegistrationHelpText")} forLabel={t("userRegistration")} - forID="kc-user-reg" + forID={t(`common:helpLabel`, { label: t("userRegistration") })} /> } hasNoPaddingTop > <Switch - id="kc-user-reg" + id="kc-user-reg-switch" data-testid="user-reg-switch" name="registrationAllowed" label={t("common:on")} @@ -56,13 +56,13 @@ export const RealmSettingsLoginTab = ({ <HelpItem helpText={t("forgotPasswordHelpText")} forLabel={t("forgotPassword")} - forID="kc-forgot-pw" + forID={t(`common:helpLabel`, { label: t("forgotPassword") })} /> } hasNoPaddingTop > <Switch - id="kc-forgot-pw" + id="kc-forgot-pw-switch" data-testid="forgot-pw-switch" name="resetPasswordAllowed" label={t("common:on")} @@ -80,13 +80,13 @@ export const RealmSettingsLoginTab = ({ <HelpItem helpText={t("rememberMeHelpText")} forLabel={t("rememberMe")} - forID="kc-remember-me" + forID={t(`common:helpLabel`, { label: t("rememberMe") })} /> } hasNoPaddingTop > <Switch - id="kc-remember-me" + id="kc-remember-me-switch" data-testid="remember-me-switch" name="rememberMe" label={t("common:on")} @@ -108,13 +108,13 @@ export const RealmSettingsLoginTab = ({ <HelpItem helpText={t("emailAsUsernameHelpText")} forLabel={t("emailAsUsername")} - forID="kc-email-as-username" + forID={t(`common:helpLabel`, { label: t("emailAsUsername") })} /> } hasNoPaddingTop > <Switch - id="kc-email-as-username" + id="kc-email-as-username-switch" data-testid="email-as-username-switch" name="registrationEmailAsUsername" label={t("common:on")} @@ -132,13 +132,13 @@ export const RealmSettingsLoginTab = ({ <HelpItem helpText={t("loginWithEmailHelpText")} forLabel={t("loginWithEmail")} - forID="kc-login-with-email" + forID={t(`common:helpLabel`, { label: t("loginWithEmail") })} /> } hasNoPaddingTop > <Switch - id="kc-login-with-email" + id="kc-login-with-email-switch" data-testid="login-with-email-switch" name="loginWithEmailAllowed" label={t("common:on")} @@ -156,13 +156,13 @@ export const RealmSettingsLoginTab = ({ <HelpItem helpText={t("duplicateEmailsHelpText")} forLabel={t("duplicateEmails")} - forID="kc-duplicate-emails" + forID={t(`common:helpLabel`, { label: t("duplicateEmails") })} /> } hasNoPaddingTop > <Switch - id="kc-duplicate-emails" + id="kc-duplicate-emails-switch" data-testid="duplicate-emails-switch" label={t("common:on")} labelOff={t("common:off")} @@ -188,13 +188,13 @@ export const RealmSettingsLoginTab = ({ <HelpItem helpText={t("verifyEmailHelpText")} forLabel={t("verifyEmail")} - forID="kc-verify-email" + forID={t(`common:helpLabel`, { label: t("verifyEmail") })} /> } hasNoPaddingTop > <Switch - id="kc-verify-email" + id="kc-verify-email-switch" data-testid="verify-email-switch" name="verifyEmail" label={t("common:on")} diff --git a/src/realm-settings/event-config/EventConfigForm.tsx b/src/realm-settings/event-config/EventConfigForm.tsx index a4a5f9517d..3f228c26c3 100644 --- a/src/realm-settings/event-config/EventConfigForm.tsx +++ b/src/realm-settings/event-config/EventConfigForm.tsx @@ -57,7 +57,7 @@ export const EventConfigForm = ({ <HelpItem helpText={`realm-settings-help:save-${type}-events`} forLabel={t("saveEvents")} - forID={eventKey} + forID={t(`common:helpLabel`, { label: t("saveEvents") })} /> } > @@ -68,7 +68,7 @@ export const EventConfigForm = ({ render={({ onChange, value }) => ( <Switch data-testid={eventKey} - id={eventKey} + id={`${eventKey}-switch`} label={t("common:on")} labelOff={t("common:off")} isChecked={value} @@ -94,7 +94,7 @@ export const EventConfigForm = ({ <HelpItem helpText="realm-settings-help:includeRepresentation" forLabel={t("includeRepresentation")} - forID="includeRepresentation" + forID={t(`common:helpLabel`, { label: t("includeRepresentation") })} /> } > @@ -123,7 +123,7 @@ export const EventConfigForm = ({ <HelpItem helpText="realm-settings-help:expiration" forLabel={t("expiration")} - forID="expiration" + forID={t(`common:helpLabel`, { label: t("expiration") })} /> } > diff --git a/src/realm-settings/event-config/EventsTab.tsx b/src/realm-settings/event-config/EventsTab.tsx index 01cc384e54..5886143bbf 100644 --- a/src/realm-settings/event-config/EventsTab.tsx +++ b/src/realm-settings/event-config/EventsTab.tsx @@ -138,7 +138,7 @@ export const EventsTab = () => { data-testid="rs-events-tab" > <PageSection> - <Title headingLevel="h4" size="xl"> + <Title headingLevel="h1" size="xl"> {t("userEventsConfig")} diff --git a/src/user/UserForm.tsx b/src/user/UserForm.tsx index c2102211ec..9ac92c1002 100644 --- a/src/user/UserForm.tsx +++ b/src/user/UserForm.tsx @@ -214,7 +214,7 @@ export const UserForm = ({ } > @@ -270,7 +270,7 @@ export const UserForm = ({ } > @@ -299,7 +299,7 @@ export const UserForm = ({ } > @@ -346,7 +346,7 @@ export const UserForm = ({ } >