Skip to content

[examples/editable-voids] Undoing a new editable void can crash with pending focus operations #17

Description

@wudidewo12

Description

In examples/editable-voids, undoing after typing into the native Name input of a newly inserted editable void can surface a runtime error from focus handling.

This is separate from the previously tracked Cmd+Z caret-restoration issue. The document visually undoes/removes the newly inserted editable void, but then the page can crash with a pending focus operations error.

Recording

Screenshot attached below:

Runtime error after Cmd+Z:
[drag /Users/dream/Desktop/regression-issues/screenshots/raw/unstable-001-editable-voids-undo-focus-pending-operations.png here]

Video attached below:

CleanShot.2026-05-23.at.00.43.32.mp4

Sandbox

No standalone sandbox. Reproduced in the Slate Editable Voids example.

Local reproduction URL:

http://localhost:3100/examples/editable-voids

Steps

  1. Open examples/editable-voids.
  2. Click + to insert a new editable void block.
  3. In the Name input inside the newly inserted editable void, type abc.
  4. Press Cmd+Z.

Expectation

Undo should remove the newly inserted editable void and the page should remain usable without any runtime error.

Actual behavior

The newly inserted editable void can be removed, but the page shows a runtime error:

Could not set focus, editor seems stuck with pending operations

The stack points to packages/slate-dom/src/plugin/dom-editor.ts in Object.focus.

Environment

  • Slate Version: v2 branch, commit e62c2046
  • Operating System: macOS
  • Browser: Chrome
  • Local examples site: http://localhost:3100

Impact

This breaks a normal undo path in examples/editable-voids. A user can trigger a runtime error by inserting an editable void, typing in its native input, and undoing.

Activity

  1. zbeyens commented on May 24, 2026

    @zbeyens
    Member

    🟢 95-100% confidence

    Phase 🧪 Tests 🌐 Browser
    Reproduced ✅ Current v2 does not reproduce the pending-focus crash ✅ Desktop Chrome undo flow on editable-voids
    Verified 🟢 Strengthened the Chrome Playwright row for this exact flow ✅ Undo removes the inserted void without runtime error

    🌐 Browser Check

    • Open http://localhost:3100/examples/editable-voids.
    • Click + to insert a new editable void.
    • Type abc into the Name input inside the newly inserted void.
    • Press Cmd+Z.
    • Confirm the inserted void is removed and the page stays usable without Could not set focus, editor seems stuck with pending operations.

    ✅ Outcome

    • Current v2 removes the newly inserted editable void on undo.
    • The pending-focus runtime error does not occur in the verified Chrome flow.
    • I tightened the existing browser row so it explicitly records that error pattern and fails if it appears after undo settles.

    ⚠️ Caveat

    • This is classified as already accounted in current v2. I did not change runtime behavior.

    🏗️ Design

    • Chosen owner: slate-react / slate-browser editable-voids browser proof.
    • Why not quick patch: N/A; current v2 already passes the reported flow.
    • Why not broader change: The current focus/history path is already stable for this case, so a runtime rewrite would be unnecessary risk.

    🧪 Verified

    • PLAYWRIGHT_BASE_URL=http://localhost:3100 PLAYWRIGHT_RETRIES=0 PLAYWRIGHT_WORKERS=1 bun playwright playwright/integration/examples/editable-voids.test.ts --project=chromium --grep "undo from a new editable void input removes the inserted void block"
    • PLAYWRIGHT_BASE_URL=http://localhost:3100 PLAYWRIGHT_RETRIES=0 PLAYWRIGHT_WORKERS=1 bun playwright playwright/integration/examples/editable-voids.test.ts --project=chromium
    • bun check
    • bun lint:fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions