As a reader, I want to tap a link and land on the document it points to, inside the app, so that I can follow a train of thought and find my way back.
Situation
I am reading a document that points to others: links in the text, mentions of people and pages, cards that show another document, lists of documents and buttons.
What I do
Tap a link in the text, a mention, a card, a row in a list, or a button.
Read the document that opens.
Tap Back, or swipe from the left edge, to return one page at a time.
What I should see
A link to a Hypermedia document opens that document in the app, on top of the one I was reading.
A mention shows the name of the person or page, not an address, and opens that page. A mention of a person opens their home document.
A card for an embedded document, a card or row in a list, a row under "In this space" and a button all open their document with one tap.
A link to a web page of the site I am reading also opens in the app.
Each opened document has a Back button. Back, or a swipe from the edge, returns to the page before.
Going back shows the earlier page at once, as I left it, without loading again.
A link that names a version or a paragraph opens the document from the top, at its latest version.
Links to other web addresses, email addresses and phone numbers are ordinary links that my phone opens outside the reader.
Text whose link is not a kind the app can follow safely is shown as plain text.
When something goes wrong
If the document behind a link cannot be loaded, the page is titled "Document" and shows the reason with "Retry", for example "This document doesn't exist on this server." I tap "Retry", or Back to return to where I was.
A card whose document cannot be found shows a warning symbol and "This document is not available." The rest of the page still reads normally.
Not included
A link to a single paragraph does not scroll to it or highlight it (Deep links and URL handling).
A link to a specific version shows the latest version instead.
A web link to a different Seed site leaves the app instead of opening in the reader. To read it here I paste it into Open site (Moving between tabs and into the app).
There is no history list and no Forward.
Trace
Story US-READ-03, status Shipped. These links are kept in step with the traceability matrix and with the "User stories" section of every page listed here.
Design
Page | Part it plays |
|---|---|
Every link pushes another copy of this screen; the Actions table | |
Which links stay in the app and which are left as web links | |
Documents are pushed on the Read stack; how Back works | |
Back on every pushed document | |
Links are followed on the site of the page being read | |
The element behind every row, card, button and inline link | |
Inline links and mentions in text, button blocks, media rows | |
Embed cards and query cards and rows as single links | |
A query result card that opens its document | |
A document row that opens its document | |
The failure line when a linked document cannot load | |
When a link leaves the app | |
Rows that navigate | |
Following a link costs one tap and no decision | |
Mentions read as names, not addresses |
Implementation
Page | Part it plays |
|---|---|
refFromUrl, linkTarget and docHref: which URLs become in-app locations | |
Link and mention annotations become Markdown links; embed, button and media hrefs | |
Mention names, redirects, and the caches that make Back instant | |
The link elements in DocBlockView, DocItemRow and DocCard | |
readStack, readRefs and the doc route | |
readDocs loads every document on the stack | |
The doc route as the one entry point; readScopedHref | |
follow, go, back and the root navigate handler | |
main navigate=follow and navigationBack | |
/api/Resource (with redirects) and /api/ResourceMetadata for mention names | |
The link element and navigation attributes | |
read.test.contract push and Back tests | |
deep-links.test.ts, markdown.test.ts and edge-cases.test.ts |
Code
File | What |
|---|---|
linkTarget: hm links and same-site pages stay in the app, the rest is left as is | |
refFromUrl: hm:// and /hm/ gateway URLs become refs, version and fragment dropped | |
Link and Embed (mention) annotations rendered as Markdown links | |
Embed, Button and media rows get their href | |
Mention names looked up for inline mentions | |
fetchDocument: follows redirects, names the failure | |
readScopedHref | |
follow and back | |
main with navigate=follow and navigationBack="back" | |
DocItemRow is a link to its document | |
Embed card, query results, button and media links in DocBlockView |
Tests
File | What it checks |
|---|---|
a child document pushes and Back returns home | |
an embed renders as a card and a query lists documents | |
a Card query renders a card grid with face piles | |
links to the current server's site stay in the app; other hosts open outside | |
hyper.media home: paragraphs with in-app links, headings, list markers, a table | |
an inline mention (Embed annotation) reads its target name | |
external buttons and videos keep external URLs | |
document links cannot execute active URL schemes |
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime