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: contact page accessibility problems #792

Merged
merged 15 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
11 changes: 7 additions & 4 deletions src/assets/locales/de/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@
"contact.info-link": "<0>Nutzen Sie unser Kontaktformular oder schreiben Sie uns eine E-Mail an <1>[email protected]</1></0>",
"contact.info": "Nutzen Sie unser Kontaktformular oder schreiben Sie uns eine E-Mail an [email protected]",
"contact.name": "Name",
"contact.name-placeholder": "z.B. Max Mustermann",
"contact.email": "E-Mail Adresse",
"contact.email-placeholder": "z.B. [email protected]",
"contact.message": "Deine Nachricht an uns",
"contact.message-placeholder": "z.B. Hallo Satellytes, ...",
"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
13 changes: 8 additions & 5 deletions src/assets/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,17 @@
"contact.info-link": "<0>Please use our contact form or send us an email to <1>[email protected]</1></0>",
"contact.info": "Please use our contact form or send us an email to [email protected]",
"contact.name": "Name",
"contact.name-placeholder": "e.g. John Doe",
"contact.email": "E-mail address",
"contact.email-placeholder": "e.g. [email protected]",
virus-rpi marked this conversation as resolved.
Show resolved Hide resolved
"contact.message": "Your message to us",
"contact.message-placeholder": "e.g. Hello Satellytes, ...",
"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}
virus-rpi marked this conversation as resolved.
Show resolved Hide resolved
{...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.5)',
errorMessage: '#FF0D35',
errorMessage: '#EB0027',
virus-rpi marked this conversation as resolved.
Show resolved Hide resolved
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'}
virus-rpi marked this conversation as resolved.
Show resolved Hide resolved
>
Google Maps &gt;
</StyledLink>
</SectionHeader>
Expand Down
3 changes: 3 additions & 0 deletions src/components/pages/contact/form-fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const FirstName = ({ control }) => {
<TextInput
name={'first_name'}
label={t('contact.name')}
placeholder={t('contact.name-placeholder')}
control={control}
rules={{ required: t('contact.error.name') }}
/>
Expand All @@ -35,6 +36,7 @@ export const Email = ({ control }) => {
<TextInput
name={'email'}
label={t('contact.email')}
placeholder={t('contact.email-placeholder')}
control={control}
rules={{
required: t('contact.error.email'),
Expand All @@ -59,6 +61,7 @@ export const MessageArea = ({ control }) => {
<TextArea
name={'message'}
label={t('contact.message')}
placeholder={t('contact.message-placeholder')}
control={control}
rules={{ required: t('contact.error.message') }}
/>
Expand Down
4 changes: 3 additions & 1 deletion src/components/pages/contact/honeypot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { FormData } from './form';

const HoneypotFieldContainer = styled.div`
${hideVisually()}
aria-hidden: true;
virus-rpi marked this conversation as resolved.
Show resolved Hide resolved
`;

export const HoneypotField = (
Expand All @@ -14,14 +15,15 @@ export const HoneypotField = (
const { field } = useController(props);
return (
<HoneypotFieldContainer>
<label>
<label aria-hidden={true}>
{props.label}
<input
id={props.name}
type="text"
{...field}
tabIndex={-1}
autoComplete="false"
aria-hidden={true}
virus-rpi marked this conversation as resolved.
Show resolved Hide resolved
/>
</label>
</HoneypotFieldContainer>
Expand Down
5 changes: 4 additions & 1 deletion src/templates/blog-post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ export const Head = ({
const { author, seoMetaText, title, publicationDate, heroImage } =
data.contentfulBlogPost;

const shareImagePath = heroImage.shareImage.resize.src;
let shareImagePath = '';
if (heroImage && heroImage.shareImage && heroImage.shareImage.resize) {
shareImagePath = heroImage.shareImage.resize.src;
}
virus-rpi marked this conversation as resolved.
Show resolved Hide resolved

/*
* SEO Notes:
Expand Down