Accessible Pretext

Demos

Small browser demos for the kinds of layout work Pretext unlocks: text height without DOM measurement in the hot path, manual line routing, and width-tight multiline UI.

Accordion

Expand and collapse sections whose text heights are calculated from Pretext.

Bubbles

Tight multiline message bubbles that keep the same line count with less wasted area.

Dynamic Layout

A fixed-height editorial spread with obstacle-aware title routing and continuous flow.

Variable Typographic ASCII

Particle-driven ASCII art comparing proportional measured glyphs against a monospace version.

Editorial Engine

Animated orbs, live text reflow, pull quotes, and multi-column flow with zero DOM measurements.

Rich Text

Rich inline text, code spans, links, and chips laid out together, with pills staying whole while text keeps wrapping naturally.

Masonry

A text-card occlusion demo where height prediction comes from Pretext instead of DOM reads.

Get the code

This is an accessible fork of Pretext with full accessibility enhancements, progressive enhancement for no-JS environments, and search engine indexable content across every demo.

github.com/TheMarco/pretext-a11y

Accessibility enhancements

Pretext is a DOM-free text measurement engine. That means the visual layouts in these demos are computed in JavaScript and rendered as positioned elements — which is powerful, but invisible to screen readers by default. Every demo has been enhanced to prove that ambitious visual work and genuine accessibility can coexist.

The core pattern across all demos:

Progressive enhancement: works without JavaScript

Pretext is a JavaScript library, so it would be easy to assume these demos are useless without JS. We made sure that's not the case. Every demo follows a progressive enhancement strategy where content is accessible even when JavaScript is unavailable — in text browsers like Lynx, in restrictive corporate environments, in search engine crawlers, and in browser reader modes.

Why this matters: SEO and discoverability

Without these enhancements, none of the demo content would be indexed by search engines. The original demos render all text via JavaScript into absolutely-positioned fragments — search engine crawlers, AI systems, and social media link previews see empty markup. No headings, no paragraphs, no content. The pages are effectively invisible to the non-JavaScript web.

With pre-populated HTML, all content is immediately available to Google, Bing, DuckDuckGo, AI crawlers (ChatGPT, Perplexity, Claude), RSS readers, browser reader modes, translation services, and social media Open Graph scrapers. Accessibility and SEO are not separate concerns — they are the same principle: content should exist as semantic HTML first, with visual enhancement layered on top.

Each demo page includes a detailed "Accessibility in this demo" section explaining exactly what was done and why. The goal is not just technical compliance — it's demonstrating that the accessible path can be the default, best-supported path for any Pretext-powered layout.

All accessibility enhancements by Marco van Hylckama Vlieg@AIandDesign