chenglou / chenglou/pretext

Accessibility use case: using Pretext for WCAG text measurement

Open
#59 0 comments 7 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
50.3k
Forks
2.7k
Avg merge
2h 40m
Merged PRs (30d)
69

Description

Hi @chenglou — congratulations on Pretext, it's an incredible piece of engineering.

I'm building **[ReadCheck](https://github.com/rafaelwabisabi-maker/readcheck)**, an open-source accessibility measurement engine that uses Pretext's canvas-based text measurement to detect accessibility barriers on websites — with particular focus on elderly and low-literacy users.

## Why Pretext matters for accessibility

Current accessibility tools (axe-core, Lighthouse, Pa11y) are limited to DOM-attribute checks. They cannot express rules that require **text layout measurement** because `getBoundingClientRect()` triggers expensive reflows. Pretext's `prepare()`/`layout()` architecture changes this — for the first time, we can measure text dimensions at scale without blocking the render pipeline.

This enables **3 novel accessibility rule types** that no existing tool can express:

1. **text-overflow-risk** — predict text overflow at different zoom levels *before* rendering (WCAG 1.4.4)
2. **visual-truncation-unlabeled** — detect `text-overflow: ellipsis` where truncated content isn't exposed via `aria-label` or `title`
3. **line-length-density** — measure characters per visual line for cognitive load scoring (WCAG 1.4.8, anticipating WCAG 3.0 cognitive criteria)

## Context

- 94.8% of the top 1M websites fail WCAG (WebAIM 2025)
- The European Accessibility Act (enforced June 2025) carries €3M fines
- Commercial overlays (accessiBe) were fined $1M by the FTC — the community needs open-source alternatives
- ReadCheck is applying for NLnet NGI Zero Commons Fund to develop this further

## What I'd love to discuss

- Are there accessibility-relevant measurement utilities that would make sense as Pretext built-ins or companion helpers?
- Any guidance on the canvas-to-rendered accuracy gap (sub-pixel hinting, font fallback chains) — we're building a calibration coefficient approach
- Would you be open to a "building accessibility tools with Pretext" documentation contribution?

Early demo: open `demo/index.html` in the ReadCheck repo.

Thanks for building something that makes genuinely new accessibility tooling possible.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the accessibility use cases and the early demo at demo/index.html in the ReadCheck repository. The issue does not identify a Pretext file, test, or entry point; clarify whether the intended outcome is built-in measurement utilities, companion helpers, or documentation before implementation, then define the accepted scope and validation approach.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
accessibility, documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.