Skip to content

Commit

Permalink
fix: contact page accessibility problems (#792)
Browse files Browse the repository at this point in the history
* fix: made error color contrast AA compliant

* fix: contact form error messages more clear

* fix: made honeypot fields aria-invisible

* feat: add placeholders to contact form

* feat: add aria-lable to google maps link

* fix: netlify build error fix

* fix: removed redundant aria-hidden

* feat: add aria-hidden to mandatory note at the bottom of the contact field because screen reader says what is mandatory

* fix: put in example.com in form placeholder

* chore: remove placeholders

* fix: format fix

* Fix: map not focusable with VoiceOver ctrl+alt+arrow key commands (still in the tab order)

---------

Co-authored-by: noa.santo <noa.santo@satellytes.com>
  • Loading branch information
virus-rpi and noa.santo authored Feb 6, 2024
1 parent 00f8324 commit 5f49f4c
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/assets/locales/de/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
"contact.email": "E-Mail Adresse",
"contact.message": "Deine Nachricht an uns",
"contact.mandatory-field": "Pflichtfeld",
"contact.error.name": "Dein Name fehlt",
"contact.error.message": "Deine Nachricht fehlt",
"contact.error.email": "Deine E-Mail fehlt",
"contact.error.email-undefined": "Irgendwas stimmt an dieser E-Mail nicht",
"contact.error.name": "Das Feld Name ist nicht ausgefüllt. Bitte fülle es aus um die Nachricht senden zu können",
"contact.error.message": "Das Feld Nachricht ist nicht ausgefüllt. Bitte fülle es aus um die Nachricht senden zu können",
"contact.error.email": "Das Feld E-Mail ist nicht ausgefüllt. Bitte fülle es aus um die Nachricht senden zu können",
"contact.error.email-undefined": "Irgendwas stimmt an dieser E-Mail nicht. Bitte überprüfe sie und versuche es noch einmal",
"contact.action.again-text": "Leider gab es einen Fehler. Bitte versuche es noch einmal. Klappt das nicht, schicke deine Nachricht bitte direkt an",
"contact.action.missing": "Bitte fülle alle benötigten Felder aus",
"contact.action.send": "Senden",
Expand Down
10 changes: 5 additions & 5 deletions src/assets/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@
"contact.email": "E-mail address",
"contact.message": "Your message to us",
"contact.mandatory-field": "Mandatory field",
"contact.error.name": "Your name is missing",
"contact.error.message": "Your message is missing",
"contact.error.email": "Your email is missing",
"contact.error.email-undefined": "Something is wrong with this email",
"contact.action.again-text": "Unfortunately, there was a mistake. Please try again. If this does not work, please send your message directly to",
"contact.error.name": "The field name is not filled in. Please fill in the field name to send the message.",
"contact.error.message": "The field message is not filled in. Please fill in the field message to send the message.",
"contact.error.email": "The field email is not filled in. Please fill in the field email to send the message.",
"contact.error.email-undefined": "Something is wrong with this email. Please check the email address and try again.",
"contact.action.again-text": "Unfortunately, there was a error. Please try again. If this does not work, please send your message directly to",
"contact.action.missing": "Please fill in all required fields",
"contact.action.send": "Send",
"contact.action.again": "Send again",
Expand Down
6 changes: 5 additions & 1 deletion src/components/forms/text-area/text-area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ const StyledTextArea = styled.textarea<{ $hasError?: boolean }>`
`;

export const TextArea = (
props: UseControllerProps<FormDataProps> & { label: string },
props: UseControllerProps<FormDataProps> & {
label: string;
placeholder?: string;
},
) => {
const { field, fieldState, formState } = useController(props);
const errorMessage = fieldState?.error?.message;
Expand All @@ -50,6 +53,7 @@ export const TextArea = (
value={(field?.value as string) || ''}
name={props.name}
id={props.name}
placeholder={props.placeholder}
/>

{errorMessage && <StyledErrorMessage>{errorMessage}</StyledErrorMessage>}
Expand Down
6 changes: 5 additions & 1 deletion src/components/forms/text-input/text-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ export const StyledErrorMessage = styled.span`
`;

export const TextInput = (
props: UseControllerProps<FormDataProps> & { label: string },
props: UseControllerProps<FormDataProps> & {
label: string;
placeholder?: string;
},
) => {
const { field, fieldState, formState } = useController(props);
const errorMessage = fieldState?.error?.message;
Expand All @@ -66,6 +69,7 @@ export const TextInput = (
$hasError={Boolean(errorMessage)}
disabled={formState.isSubmitting}
id={props.name}
placeholder={props.placeholder}
{...field}
value={(field?.value as string) || ''}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const theme: DefaultTheme = {
secondary: 'rgba(32,40,64,0.5)',
topline: '#3E61EE',
timestamp: 'rgba(0, 0, 0, 0.65)',
errorMessage: '#FF0D35',
errorMessage: '#EB0027',
header: {
default: '#FFFFFF',
light: '#3E61EE',
Expand Down
5 changes: 4 additions & 1 deletion src/components/pages/contact/address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export const Address = () => {
80331 München
<br />
<br />
<StyledLink to="https://g.page/satellytes?share">
<StyledLink
to="https://g.page/satellytes?share"
aria-label={'Open Satellytes Google Maps profile in a new tab'}
>
Google Maps &gt;
</StyledLink>
</SectionHeader>
Expand Down
10 changes: 9 additions & 1 deletion src/components/pages/contact/contact-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ import { ContentBlockContainer } from '../../layout/content-block-container';
import { Layout } from '../../layout/layout';

export const ContactPage = () => (
<Layout transparentHeader={true} light={true} hero={<Leaflet />}>
<Layout
transparentHeader={true}
light={true}
hero={
<div aria-hidden={true} tabIndex={-1}>
<Leaflet />
</div>
}
>
<ContentBlockContainer>
<Address />
</ContentBlockContainer>
Expand Down
4 changes: 3 additions & 1 deletion src/components/pages/contact/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ export const Form = ({ onSuccess }: { onSuccess: () => any }) => {
<HoneypotField name="firstName" label="First Name" control={control} />
<HoneypotField name="phone" label="Phone" control={control} />

<MandatoryNotes>* {t('contact.mandatory-field')}</MandatoryNotes>
<MandatoryNotes aria-hidden={true}>
* {t('contact.mandatory-field')}
</MandatoryNotes>
<Submit disabled={requestStatus === 'submitting'} type={'submit'}>
{t('contact.action.send')}
</Submit>
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/contact/honeypot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const HoneypotField = (
const { field } = useController(props);
return (
<HoneypotFieldContainer>
<label>
<label aria-hidden={true}>
{props.label}
<input
id={props.name}
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/contact/leaflet/leaflet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const Leaflet = () => {
Lost?{' '}
<span
role={'img'}
aria-label={"see no evil monkey emoji, because it's embarassing"}
aria-label={"see no evil monkey emoji, because it's embarrassing"}
>
🙈
</span>{' '}
Expand Down

0 comments on commit 5f49f4c

Please sign in to comment.