Preview brand Custom

Newsletter sign-up

A band with a line of copy and one email field. No pop-up: it sits in the page, usually near the foot of the home page.

Beta

Notes from the studio

A short email now and then: new work, and what we’re learning. (This example doesn’t send.)

Now and then, never shared, and you can unsubscribe from any email. How we use your data.

Notes from the studio

A short email now and then: new work, and what we’re learning. (This example doesn’t send.)

Now and then, never shared, and you can unsubscribe from any email. How we use your data.

Show code
js
// somnia.config.mjs; on sites with settings files the words go in src/content/settings/newsletter.yaml (Somnia CMS)
newsletter: { title: 'Notes from the studio', text: 'A short email now and then: new work, and what we’re learning.', button: 'Sign up' },

// a page
<NewsletterSignup />

When to use it

  • The site has something to send, regularly, that people would choose to get.
  • After the thing people came for: under an article, near the foot of a page.

Use something else when:

  • There is nothing regular to send yet. An empty promise costs more than no sign-up.
  • You want an enquiry or a booking: that is the Contact page’s form.

How it works

  • It posts to Formspree (newsletter.formspree, else the site's forms.formspree) with its own subject, so sign-ups arrive apart from enquiries. Move them into a mailing tool by hand or with Formspree's plugins.
  • It works without JavaScript; with it, the thank-you shows in place.
  • The small print says what people will get and links to the privacy policy when the site has one.

Do and don't

Do

  • Say what will be sent and how often
  • Ask for the email address and nothing else
  • Link to the privacy policy

Don't

  • Show it as a pop-up, or over the page
  • Tick anyone in by default
  • Send anything that wasn’t promised

Accessibility

What it does for you

  • One email field, named "Email address" for screen readers, with the right keyboard on a phone and autocomplete="email".
  • A real form: it sends without script. With script the thank-you appears in place, is announced, and takes the keyboard’s focus.
  • Small print under it saying what people will get, with a link to the privacy policy when the site has one.
  • A hidden trap field for spam bots, kept away from keyboards and screen readers.
  • No pop-up, ever: it is a band on the page.

What you need to do

  • Say what will be sent and how often, in the band’s own words.
  • Put it where it follows from the page (after an article), not above what people came for.
  • Send only what was promised.

Keyboard

KeyWhat it does
TabTo the email field, then the button, then the small print’s link.
EnterIn the field or on the button: sends it.

What a screen reader is told

  • The field: its label, an email field, required.
  • The button: its words. After sending: the thank-you in place.

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 PurposeAAThe field is marked as an email address for the browser to fill.
2.1.1 KeyboardAA native form: Tab and Enter.
3.3.2 Labels or InstructionsAThe field has a label, and the small print says what signing up means.
4.1.2 Name, Role, ValueAA native field and button.

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
5 of 5 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 5 checks made with the keyboard, on the example at the top of this page:

  • Passed Tab reaches the email field, then the button
  • Passed The browser reports an email field with a name, required
  • Passed The spam trap can’t be reached with Tab, and is hidden from screen readers
  • Passed Enter in the field sends it, and the thank-you appears in place
  • Passed Focus is then on the thank-you line, which is announced

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.
  • Whether the thank-you is announced when it appears has not been checked.
  • Its label is hidden and the same words show inside the field as a placeholder, which the Form field page advises against. It is one field in a band, where that is common, but it has not been tested with people.

Evidence

Where it's used

WhereFor
Headland YachtingIts words and whether it shows are a settings page in Somnia CMS.
The starterReady for a new site to switch on.

What we saw, and what changed

WhenWhat we sawWhat changed
Somnia had no part for collecting email addresses; the contact form was its only form.Newsletter sign-up added: one field, posting with its own subject so sign-ups arrive apart from enquiries (1.22.0).
Reviews and the message bar could be taken off every page with their words kept; the newsletter band could not.The same show setting (1.49.0).
After signing up, the field and button are taken away, and the keyboard’s focus went with them to the top of the page.Focus goes to the thank-you line (1.82.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 sign up is not measured here.
  • There is no confirmation email (double opt-in): the form service doesn’t send one.