Preview brand Custom

Contact page

The contact page every Somnia DS site gets: its form, wording and Direct panel all come from the site's config.

Beta

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 direct lines 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=…).

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

KeyWhat it does
TabTo the switch (when there are two forms), then the fields in order, then the button.
Left and Right arrowsOn the switch: show the other form.
EnterOn 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

CriterionLevelHow this meets it
1.3.5 Identify Input PurposeAAName, email, phone and organisation carry autocomplete.
2.1.1 KeyboardAEverything works from the keyboard.
3.2.2 On InputANothing is sent until the button is pressed.
3.3.1 Error IdentificationAA field with a problem is marked, with its message under it and read with it.
3.3.3 Error SuggestionAAMessages come from the form service in its words; the page’s own say what to do.
4.1.3 Status MessagesAAA 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

CheckHowResult
Automated (axe-core)WCAG 2.0, 2.1 and 2.2 rules at A and AA, the page in light and in darkPassed
Nothing found, light or dark
Narrow screenNo sideways scrolling at 320px wide (WCAG 1.4.10)Passed
No sideways scrolling
Keyboard and what the browser reportsReal key presses on the live example, and the role, name and state given to assistive technologyPassed
4 of 4 checks pass
On paperSomnia’s print check: no overlaps, stranded headings or controls on the pagePassed
No faults on 5 sheets
Screen readerListened to by a person, in VoiceOver and NVDANot 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

WhereFor
mediadreams.co.ukIts Contact page.
Headland YachtingContact, and a second form for a charter enquiry.
The starterEvery new site begins with one.

What we saw, and what changed

WhenWhat we sawWhat 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

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.