Skip to content

[examples/mentions] Pasting or cutting a selected mention node crashes locally #10

Description

@wudidewo12

Description

In the Mentions example, copying and pasting a selected mention node, or cutting a selected mention node, crashes the local page. The live Slate example handles the same selected mention node normally.

I reproduced this with both @R2-D2 and @Mace Windu, so this appears to affect selected mention inline void nodes generally.

Recording

Screenshots attached below:

Local actual behavior:

Image

Live reference expected behavior:

Image

Video attached below:

Not required unless the screenshots are not clear enough.

Sandbox

No standalone sandbox. Reproduced in the Slate examples site.

Local reproduction URL:

http://localhost:3100/examples/mentions

Reference URL:

https://www.slatejs.org/examples/mentions

Steps

To reproduce the copy/paste crash:

  1. Go to http://localhost:3100/examples/mentions.
  2. Click an existing mention node, such as @R2-D2 or @Mace Windu, so that the mention is selected.
  3. Press Cmd+C.
  4. Move the caret to another position in the editor.
  5. Press Cmd+V.

Alternative cut path:

  1. Go to http://localhost:3100/examples/mentions.
  2. Click an existing mention node, such as @R2-D2 or @Mace Windu, so that the mention is selected.
  3. Press Cmd+X.

Expectation

The selected mention node should copy/paste or cut successfully, matching the live Mentions example.

  • Cmd+C then Cmd+V should insert another copy of the selected mention node.
  • Cmd+X should remove the selected mention node from its original position.
  • The page should not crash.

Actual behavior

On the local Mentions example, copying then pasting a selected mention node crashes the page with a runtime error. Cutting the selected mention node also crashes.

Observed error:

Cannot read properties of null (reading 'setAttribute')

Environment

  • Local branch/commit: v2, ce2bd6c6
  • Local URL: http://localhost:3100/examples/mentions
  • Reference URL: https://www.slatejs.org/examples/mentions
  • Browser: Chrome on macOS

Impact

This breaks clipboard operations for mention inline void nodes and can crash the examples page during a normal editor copy/paste or cut workflow.

Activity

  1. zbeyens commented on May 10, 2026

    @zbeyens
    Member

    🟢 95-100% confidence

    Phase 🧪 Tests 🌐 Browser
    Reproduced ✅ Issue screenshots/transcript show selected mention copy/paste and cut crash ✅ examples/mentions flow identified
    Verified 🟢 Selected mention copy/paste and cut rows are green on current v2 07d79634 ✅ No runtime crash in Chromium proof

    🌐 Browser Check

    • Open http://localhost:3100/examples/mentions.
    • Select @R2-D2 or @Mace Windu.
    • Press Cmd+C, move the caret, then press Cmd+V.
    • Select a mention again and press Cmd+X.
    • Confirm paste inserts another mention and cut removes the selected mention without crashing.

    ✅ Outcome

    • Copy/paste of a selected mention no longer crashes.
    • Cutting a selected mention no longer crashes.

    🏗️ Design

    • Chosen owner: inline void clipboard serialization.
    • Why not quick patch: current runtime proof already covers the selected mention copy/paste and cut paths.
    • Why not broader change: the issue is limited to selected mention inline void clipboard behavior.

    🧪 Verified

    • cd /Users/zbeyens/git/slate-v2 && PLAYWRIGHT_RETRIES=0 PLAYWRIGHT_BASE_URL=http://localhost:3100 bun playwright playwright/integration/examples/plaintext.test.ts playwright/integration/examples/mentions.test.ts playwright/integration/examples/paste-html.test.ts playwright/integration/examples/iframe.test.ts --project=chromium --grep "keyboard undo restores caret after middle-line typing|keyboard undo restores partial selected text replacement|keyboard undo restores select-all replacement content|copies and pastes a selected mention without crashing|cuts a selected mention without crashing|pastes copied rendered Slate content as an internal fragment before HTML import|applies parent toolbar formatting to selected iframe text"
    • cd /Users/zbeyens/git/slate-v2 && bun check
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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions