Contact page
The contact page every Somnia DS site gets: its form, wording and Direct panel all come from the site's config.
See it on Contact.
When to use it
- Every site has one: it is where the header’s button and most pages’ last line lead.
- Add the second form when most people get in touch for one purpose (an enquiry, a booking) that needs its own questions.
Use something else when:
- Someone only needs the phone number or address: the footer and the Direct lines carry those.
- You are collecting email addresses for a mailing: the Newsletter sign-up.
How it works
The fields and words come from the site’s settings; the form is Somnia DS’s Form field throughout.
Set up in the site's config
contact.fields: the form's fields ({ name, label, type, required, autocomplete, width }; types include text, email, tel, textarea, date, number, select and a consent checkbox).- Its wording: title, lede, success message, submit label, and the
directlines beside the form. - Sent through Formspree (
forms.formspree), with a honeypot for spam and errors shown next to each field.
A second form
contact.alternate adds another form, such as a charter or booking enquiry, behind a switch at the top of the page, with its own fields, wording and a side card of steps. #<id> opens it, and a site page can open on it (<ContactPage initial="alternate" />). Links can start either form off from the address (?yacht=…&guests=…).
Search
The form and the switch are kept out of site search, so the page is found for its words, not its field labels.
Do and don't
Do
- Ask only for what you will use
- Say beside the form what happens next, and how soon
- Give another way to get in touch
Don't
- Use a puzzle to stop spam
- Clear the form when something goes wrong
- Ask for a phone number unless you will call
Accessibility
What it does for you
- The form is the Form field component throughout: labels, hints, errors tied to their fields.
- It sends without script. With script it sends in the background, the button says "Sending…", and the thank-you or the problem appears in place.
- A problem with a field is written under it and focus goes to the first one; a problem with sending is announced.
- With two forms, the switch at the top is a pair of tabs that say which is chosen; only the chosen form is in the page.
- A hidden trap field for spam bots in place of a puzzle.
What you need to do
- Ask only for what you will use. Each extra field loses people.
- Say beside the form what happens next and how soon.
- Give another way to get in touch (the direct lines) for anyone the form doesn’t suit.
Keyboard
| Key | What it does |
|---|---|
| Tab | To the switch (when there are two forms), then the fields in order, then the button. |
| Left and Right arrows | On the switch: show the other form. |
| Enter | On the button: sends. |
What a screen reader is told
- Each field as the Form field component says.
- The switch: a tab list with two tabs, one selected, each naming its form.
- After sending: the thank-you, or what went wrong.
This is what the browser reports to assistive technology. What each screen reader then says varies, and has not been listened to yet.
WCAG 2.2
| Criterion | Level | How this meets it |
|---|---|---|
| 1.3.5 Identify Input Purpose | AA | Name, email, phone and organisation carry autocomplete. |
| 2.1.1 Keyboard | A | Everything works from the keyboard. |
| 3.2.2 On Input | A | Nothing is sent until the button is pressed. |
| 3.3.1 Error Identification | A | A field with a problem is marked, with its message under it and read with it. |
| 3.3.3 Error Suggestion | AA | Messages come from the form service in its words; the page’s own say what to do. |
| 4.1.3 Status Messages | AA | A failure to send is announced without moving focus. |
The criteria this component has a part in. A page that uses it still has to meet the rest.
Checked
| Check | How | Result |
|---|---|---|
| Automated (axe-core) | WCAG 2.0, 2.1 and 2.2 rules at A and AA, the page in light and in dark | Passed Nothing found, light or dark |
| Narrow screen | No sideways scrolling at 320px wide (WCAG 1.4.10) | Passed No sideways scrolling |
| Keyboard and what the browser reports | Real key presses on the live example, and the role, name and state given to assistive technology | Passed 4 of 4 checks pass |
| On paper | Somnia’s print check: no overlaps, stranded headings or controls on the page | Passed No faults on 5 sheets |
| Screen reader | Listened to by a person, in VoiceOver and NVDA | Not yet Not yet checked by a person |
The 4 checks made with the keyboard, on the example at the top of this page:
- Passed On the Contact page, name and email carry autocomplete
- Passed A field’s problem from the form service is written under it, tied to it, and focus goes to that field
- Passed A failure to send is announced, and what was typed is kept
- Passed Tab goes through the form’s fields in order and ends on the button
Run by script on against Somnia DS 1.89.0, in Chromium with axe-core 4.14.0. How these checks work, and every component's results.
Not yet checked
- How it sounds in a screen reader (VoiceOver, NVDA, TalkBack) has not been checked by a person. The roles, names and states the browser reports are checked by script; what is actually spoken is not.
- Windows high contrast (forced colours) has not been looked at by a person.
- The switch between two forms is not pressed by the script: Media Dreams’ own contact page, where the checks run, has one form.
- The wording of the form service’s own field messages is not ours and has not been reviewed.
- There is no summary of problems at the top of the form.
Evidence
Where it's used
| Where | For |
|---|---|
| mediadreams.co.uk | Its Contact page. |
| Headland Yachting | Contact, and a second form for a charter enquiry. |
| The starter | Every new site begins with one. |
What we saw, and what changed
| When | What we saw | What changed |
|---|---|---|
| The contact page was Media Dreams’ own page. | It became a page every site gets, with its fields and words set per site (1.19.0). | |
| The second form always came second in the switch. | contact.alternate.first puts it first (1.28.0). | |
| The second form’s words were in the site’s config, where only the studio could change them. | They are a settings page in Somnia CMS, as the contact page’s were already (1.53.0). | |
| An error message was not tied to its field. | Each is, and focus goes to the first field with a problem (1.81.0). |
From building and using it on real sites, each entry taken from the changelog or the build's own notes. This is observation by the studio and its clients, not research sessions with users.
What it rests on
- GOV.UK Design System: Error message: Say what went wrong and how to fix it, beside the field.
- Nielsen Norman Group: Website forms usability: Keep forms short and say what happens next.
What we don't know yet
- How many people start the form and don’t send it is not measured.
- Spam is held off by a trap field alone; how much gets through is not counted.