docs/solutions/test-failures/2026-05-20-slate-v2-integration-local-editor-stacking-and-project-scope-failures.md
bun test:integration-local was red for a mix of real Slate v2 runtime bugs, example CSS bugs, and Playwright project coverage that claimed more browser support than the row could honestly prove.
true from onDOMBeforeInput marked the event handled, but the browser still performed its native default insertion.Slate React owns the default stacking on the public Editable root:
style={{
...(disableDefaultStyles
? {}
: {
position: 'relative',
whiteSpace: 'pre-wrap',
wordWrap: 'break-word',
zIndex: 0,
}),
...userStyle,
}}
Package tests should pin the actual contract:
expect(editable.style.zIndex).toBe('0')
render(
<Slate editor={editor}>
<Editable style={{ zIndex: 2 }} />
</Slate>
)
expect(editable.style.zIndex).toBe('2')
Keep disableDefaultStyles as the opt-out for hosts that fully own root CSS.
Do not spread style={{ zIndex: 0 }} through examples to compensate for Slate
internals.
When a user onDOMBeforeInput handler returns a truthy non-null value, prevent the native default before reporting the event as handled:
const handled = onDOMBeforeInput?.(event)
if (handled != null) {
if (handled) {
event.preventDefault()
}
return true
}
Then narrow project coverage to what each row actually proves:
The public Editable root is the element users style, click, test, and pass
IDs/classes to. A negative default root z-index makes normal app code pay for an
internal selection workaround. Keeping the root visible and hittable by default
fixes comment-mode and removes repeated example-local z-index patches without a
new public prop.
If a browser selection case still needs a stacking workaround, fix that named case in the selection/decorations runtime. Do not reintroduce a negative public root default.
The beforeinput change matches the API contract: returning true says the handler owns the event. Ownership must include cancelling the browser default, otherwise Slate records the event as handled while the DOM still mutates natively.
The project skips make the integration suite honest. A row should prove one supported behavior on the browser projects that can actually exercise it; unsupported clipboard, mobile keyboard, and native-selection shapes should not masquerade as cross-browser regressions.
<Editable className={editorCss} id="editor" />.style={{ zIndex: 0 }} patches for default
visibility. That is package-owned behavior.onDOMBeforeInput boolean-return tests tied to both command trace and native default cancellation.bun test:integration-local with a local worker cap.Editable root stacking issue.