Blockleaf

Accessibility

What the editor guarantees for keyboard and screen-reader users, what it asks of you, and how it is checked.

Blockleaf's chrome is built to be used without a mouse and announced correctly by a screen reader. That is a tested claim, not an aspiration: every surface the editor puts on screen is scanned with axe-core in a real browser on every commit, and the suite fails on a single violation.

What is checked

e2e/accessibility.spec.ts opens each surface and runs axe over it:

SurfaceHow it is opened
The editor at rest—
Slash menu/
Bubble menua text selection
Link editorMod + K
Block menuShift + F10
Drag handlehovering a block
Table, and its controls|||
Row menuCtrl + Alt + R
Grid picker/table
Callout/callout
Toggle, open and closed/toggle
Upload placeholdera failed upload
Imagea finished upload

A second Playwright project runs against an emulated phone, where nothing hovers — see On a phone.

A second suite builds a whole document — heading, list, table, link — without touching the mouse, because a surface that passes axe while being unreachable from the keyboard has passed nothing.

Colour contrast is checked here rather than in the unit suite on purpose. The jsdom tests have no layout, so contrast, focus visibility and anything that depends on where an element actually lands can only be seen in a browser.

Tables

A table is the one block where the markup carries meaning a screen reader depends on, so it gets more than a scan.

  • scope on every header cell, decided from the document's shape rather than stored: a header in a row of nothing but headers heads its column, one sitting among data cells heads its row. The editor and @blockleaf/renderer decide it the same way, so a document does not announce one way while it is edited and another once it is published.
  • The caret's position is announced as it moves between cells — "Row 2 of 4, column 3 of 3" — through a polite live region. Counted with TableMap, so a merged cell reports the first column it actually occupies rather than a number that would be false.
  • A header nobody has typed in yet is named, so it announces as an empty header rather than as nothing at all. axe still reports empty-table-header on it, because that rule checks visible text and an aria-label is not visible; the suite excepts that one rule by name and says why.
  • A table too wide for the screen scrolls inside a focusable, labelled region rather than pushing the page sideways. See On a phone.

None of it is stored, so no SCHEMA_VERSION moved and nothing in anyone's database had to change.

Keyboard

Every menu opens, moves and closes from the keyboard.

KeysWhat happens
Shift + F10Block menu for the block holding the caret
Ctrl + Alt + RRow menu, inside a table
Ctrl + Alt + CColumn menu, inside a table
Mod + KLink editor, on a selection
↑ ↓Move within a menu
EnterRun the active item
EscapeClose the menu and return the caret

Menus keep focus on the menu element and point at the active item with aria-activedescendant, so the caret's position in the document is never lost. Each menu is also in the tab order: a menu that scrolls has to be reachable, or the items below the fold cannot be read.

Images and alt text

An image with no alt is the one critical failure an editor can hand a screen reader — it falls back to announcing the URL. So an uploaded image is never inserted without one.

The order is:

  1. alt from the upload adapter's result, if it returns one.
  2. Otherwise, the file's own name, with the extension dropped and - and _ turned into spaces — red-balloon_02.png becomes red balloon 02.
const adapter: UploadAdapter = {
	upload: async (file) => {
		const stored = await putSomewhere(file);
		return {
			id: stored.id,
			src: stored.url,
			// Pass one whenever you have it. A filename is a floor, not an answer.
			alt: stored.description
		};
	}
};

An empty alt is not a missing one

Returning alt: '' marks the image decorative and screen readers skip it, which is sometimes exactly right. The editor keeps an empty string as given and does not fill it in from the filename.

Authors can change any image's alt text from the image's own toolbar, and the value is stored on the node — see the schema.

What is still open

  • A caption names the figure, not the table. An author can caption a table or an image (see Captions), and it is written as a <figure> with a <figcaption>, in the editor and in @blockleaf/renderer alike. A screen reader announces the figure by its caption and then the table, but the <table> itself is not yet labelled by it with aria-labelledby.
  • Right-to-left layout. The stylesheet uses logical properties in places and physical ones in others, and no suite checks it.

On this page