Olddevs UI4.14.0
Recipes

Autosave and the Status bar

Saving when the author leaves the field, the save status for screen readers and a word count under the field.

The line under the Document has two places: the Status bar — what the screen puts there (status) — and the kit's maxLength counter. This Recipe saves the Document when the author leaves the field and says so.

0 words

Try it

Edit the text and click outside the field: “Saving…” appears, then “Saved”. The kit's character counter shows up when the text gets to 80% of the limit.

How it works

onBlur is about the whole field

onBlur fires on Field focus: moving into the Toolbar, the link popover and back doesn't trigger it. The kit flushes the delayed onChange before onBlur, but screen state has not re-rendered yet — so the fresh Document comes from the Handle: ref.current.getHTML().

The live region stays mounted

Only the text inside role="status" changes: screen readers often don't read a region inserted together with its text.

The word count has no role

With a role the word count would be read out on every edit. The kit never announces the line itself.

A save error

Show it where the screen shows form errors. showNotice is for the field's own events (a refused paste, a file upload).

On this page