docs/plans/2026-05-20-slate-v2-document-state-example-usability.md
status: done created: 2026-05-20 completion_id: 019e3627-238b-7993-a8cf-26be45504c47 scope: .tmp/slate-v2/site/examples/ts/document-state.tsx
Fix the Document State example so the body editor is plainly editable by mouse, and title-field typing never steals selection or focus back to the editor.
document-state Playwright coverage inserts body text only after
editor.selection.select(...), so it can pass while mouse editing is broken.<Editable> intercepted clicks because the
Slate root carries default z-index: -1; the example needs a non-intercepting
wrapper and style={{ zIndex: 0 }} on the styled root.useSetStateField state writes used default selection side effects, and
selection.dom: 'preserve' was not honored by the React selection bridge.PLAYWRIGHT_RETRIES=0 bun playwright playwright/integration/examples/document-state.test.ts --project=chromiumbun test ./packages/slate-react/test/selection-side-effect-policy-contract.tsbun --filter slate-react typecheckbun typecheck:sitebun typecheck:rootbun lint:fixdev-browser --connect http://127.0.0.1:9222 on http://localhost:3100/examples/document-state
with click editor -> type, click title -> type, click editor -> type.
Screenshot: /Users/zbeyens/.dev-browser/tmp/slate-document-state-usability.pngdocs/solutions/ui-bugs/2026-05-20-slate-react-state-field-setters-must-preserve-external-focus.md