Read more
Long text cut to a few lines, or the long tail of a list put behind a button, opened in place. Nothing is ever really hidden: it is all there without JavaScript, on paper and to a screen reader.
Read more: long text
Sea Hare is a 51-foot catamaran with four guest cabins, each with its own bathroom, and a wide shaded cockpit where most of the week is spent. She is steady under sail and quiet at anchor, which is why families with young children ask for her by name.
Her crew have sailed these islands for eleven seasons. They know which bays are empty on a Tuesday, where the turtles feed in the morning, and which beach bar still cooks over wood.
She carries paddleboards, snorkelling gear for every guest and a tender that will pull a wakeboard.
Sea Hare is a 51-foot catamaran with four guest cabins, each with its own bathroom, and a wide shaded cockpit where most of the week is spent. She is steady under sail and quiet at anchor, which is why families with young children ask for her by name.
Her crew have sailed these islands for eleven seasons. They know which bays are empty on a Tuesday, where the turtles feed in the morning, and which beach bar still cooks over wood.
She carries paddleboards, snorkelling gear for every guest and a tender that will pull a wakeboard.
Show code
---
import ReadMore from '@somnia/core/components/ReadMore.astro';
---
<ReadMore lines={3}>
<p>Sea Hare is a 51-foot catamaran with four guest cabins…</p>
<p>Her crew have sailed these islands for eleven seasons…</p>
</ReadMore>
<!-- The button's own words -->
<ReadMore lines={5} label="See the whole menu">…</ReadMore> - Cut to a number of lines (
lines, four unless told), across paragraphs, with the last line fading out. - Only when it's worth it: the button appears only if it would hide two lines or more. Text a line or two over simply shows in full. This is checked again when the width changes.
- Opens in place and becomes "Show less". Closing takes the reader back to the start of the text if it has gone off the top of the screen.
- The button's words can say what's behind it (
label="See the whole menu").
See more: the rest of a list
- Paddleboards
- Snorkelling gear
- Kayak
- Fishing rods
- Floating mats
- Wakeboard
- Underwater camera
- Paddleboards
- Snorkelling gear
- Kayak
- Fishing rods
- Floating mats
- Wakeboard
- Underwater camera
Show code
---
import Reveal from '@somnia/core/components/Reveal.astro';
---
<ul class="sn-list"><li>Paddleboards</li><li>Snorkelling gear</li><li>Kayak</li></ul>
<Reveal more="See 4 more" less="Show less">
<ul class="sn-list"><li>Fishing rods</li><li>Floating mats</li><li>Wakeboard</li><li>Underwater camera</li></ul>
</Reveal> - The important part sits outside; only the rest goes in
Reveal. - Say how much is behind the button when it's known: "See 4 more", "More on rates".
- Hide only what saves real space. A list of five shows all five.
Which one?
| There is | Use |
|---|---|
| A long description someone may or may not want | Read more |
| A list or set of notes with a long tail | See more |
| Several questions, each with an answer | Accordion |
| Whole sections of a long page | Accordion sections with a Sections toggle |
Without JavaScript, and on paper
- Without JavaScript nothing is cut and there is no button: the script adds both.
- On paper everything prints in full, open or closed. The exception is a reader who chose "Only what's showing" on a print button: then closed text stays closed.
- The buttons themselves are never printed.
Do and don't
Do
- Put the part most people need above the cut
- Use it where a page would otherwise be mostly one item's detail
Don't
- Cut text that is only a line or two longer
- Hide prices, terms or anything someone must see
Accessibility
What it does for you
- A real button that says whether it is open (
aria-expanded). - Cut text is only clipped from view: a screen reader reads all of it and find-in-page finds it.
- Without JavaScript nothing is cut. On paper everything prints.
- Opening moves nothing but the text below, and the focus stays on the button.
- Closing takes the reader back to the start of what closed, if it has gone off the top of the screen.
What you need to do
- Put what most people need above the cut.
- Say what’s behind the button when "Read more" isn’t enough: "See the whole menu", "See 4 more".
- Never cut prices, terms, or anything someone must see to decide.
Keyboard
| Key | What it does |
|---|---|
| Tab | Moves to the button. |
| Enter or Space | Opens the text, or closes it again. The focus stays on the button. |
What a screen reader is told
- A button named "Read more", collapsed; once open, "Show less", expanded.
- The whole text, cut or not: the cut is only something seen.
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.1 Info and Relationships | A | The text is in the page in order; only its height is limited. |
| 2.1.1 Keyboard | A | A native button. |
| 4.1.2 Name, Role, Value | A | The button says whether it is open. |
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 5 of 5 checks pass |
| On paper | Somnia’s print check: no overlaps, stranded headings or controls on the page | Passed No faults on 6 sheets |
| Screen reader | Listened to by a person, in VoiceOver and NVDA | Not 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 Read more, which says it is closed
- Passed Enter opens the text in place and the button becomes Show less
- Passed The focus stays on the button, and Enter closes it again
- Passed Text that is cut is still in the page for a screen reader and for find-in-page
- Passed See more: Enter shows the rest of the list, and the button says how to close it
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.
- The Read more button is a line of text about 21px high. It passes the target-size check by the space around it, not by its own size.
- A screen reader user hears the whole text and then a button offering to "Read more" of what they have just heard. Whether that confuses has not been checked with them.
Evidence
Where it's used
| Where | For |
|---|---|
| Headland Yachting, yacht pages | The crew’s and chef’s descriptions, sample menus, special offers. On its staging site until launch. |
| Headland Yachting, yacht pages | See more: "Also on board", "More on scuba diving", "More on rates". |
| Reviews and Testimonials | Long reviews cut to a few lines. |
What we saw, and what changed
| When | What we saw | What changed |
|---|---|---|
| Yacht pages carry long descriptions from their operators: the crew, the chef, sample menus. A Read more that hid only a line or two wasn’t worth a press. | The button appears only when it would hide two lines or more (1.32.0). | |
| David’s rule for paper: everything behind a control prints. | Cut text and hidden lists print in full, unless the reader asks for only what’s showing. | |
| Closing a long block left the reader far down the page, looking at something else. | First try: keep the button where it was on screen (1.47.1). | |
| Keeping the button in place left the reader looking at what came after the block, not the block. | Closing now goes back to the start of what closed (1.49.1). |
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
- ARIA Authoring Practices: Disclosure: A button with
aria-expandedthat shows and hides content. - Nielsen Norman Group: Progressive Disclosure: Show the few things most people need first; let the rest be asked for.
What we don't know yet
- We don’t know how often Read more is pressed. Headland’s pages are not yet live, and its analytics don’t count the button.