[Beta]: Undo in an input inside a void runs the editor's undo instead of the input's

オープン
#5,246 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
57/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
react, typescript
領域
frontend

調査の方向性

Start by reading packages/plitejs/src/react/editable/keyboard-input-strategy.ts, especially the interactive element key handling at the cited lines 492 and 611. Reproduce the issue in the editable-voids and embeds examples, then trace how ⌘Z and ⌘⇧Z are handled for inputs inside voids. Done means those shortcuts undo and redo the input edit while leaving editor history and focus unchanged.

索引モデルが issue の本文から書いたものです。

説明

bug target:beta

Testing lane

  • Repository: udecode/plate
  • Branch: next
  • Release channel: Beta
  • Exact commit/package version: NOT_ENOUGH_INFO

Summary

When focus is in a native input inside a void element, ⌘Z does not undo the input's own edit on Beta. On /examples/plite/editable-voids it undoes the last edit in the void's child editor instead and moves focus there. On /examples/plite/embeds it does nothing, so a deleted character in the video URL does not come back. On slatejs.org, ⌘Z in the same inputs undoes the input's edit.

Reproduction

Repro 1: /examples/plite/editable-voids, Chrome
  1. Open https://beta.platejs.org/examples/plite/editable-voids.
  2. Click the end of A wise quote. in the child editor under Tell us about yourself, and type alpha.
  3. Click the Name input and type a.
  4. Press Shift+← and Backspace. Name is empty again.
  5. Press ⌘Z, then ⌘⇧Z.

⌘Z removes alpha from the child editor and moves focus into it. ⌘⇧Z adds alpha back. Name stays empty. On https://www.slatejs.org/examples/editable-voids, ⌘Z brings back a in Name, ⌘⇧Z removes it again, focus stays in Name and the child editor keeps alpha. On a fresh Beta page, where the child editor has no history yet, ⌘Z in Name leaves focus in Name.

Repro 2: /examples/plite/embeds, Chrome
  1. Open https://beta.platejs.org/examples/plite/embeds.
  2. Click the end of the video URL input under the video. It reads https://player.vimeo.com/video/26689853.
  3. Press Backspace. The input reads …/2668985.
  4. Press ⌘Z.

The input still reads …/2668985, and focus stays in it. On https://www.slatejs.org/examples/embeds, ⌘Z brings the 3 back.

Expected

⌘Z and ⌘⇧Z in an input inside a void act on that input, as on slatejs.org. The editor's history and focus stay as they are.

Actual

Beta runs its own undo for the key press. In repro 1 that undoes the child editor's edit and moves focus. In repro 2 the input's edit is not undone.

Environment

  • Exact next commit/Beta package version: NOT_ENOUGH_INFO
  • Repro 1: Chromium 152 in an agent's browser on 2026-10-21, and desktop Chrome in a second agent run. The recording uses headless Chromium 149 on macOS, driven by Playwright with real key presses, on 2026-10-24.
  • Repro 2: Chrome 155 on macOS on 2026-10-20, confirmed by natamox by hand the same day. The recording uses headless Chromium 149 on 2026-10-24.

Caveat

  • Nobody has traced the cause. A suspect is the key handling for interactive elements inside the editor in packages/plitejs/src/react/editable/keyboard-input-strategy.ts (lines 492 and 611 on next): it looks like ⌘Z there runs the editor's undo and calls preventDefault, which also blocks the input's native undo. This is a reading of the code, not checked with a breakpoint.
  • The embeds example's URL input is written the same way as Slate's, and the input stays the same DOM node after the update, so the difference is in the editor's event path.
  • Neither example's outer editor undo is part of this issue. Slate's embeds example has no history either.

Evidence

  • Repro 1: headless Chromium recording, 46 seconds, with an English step panel and a readout box drawn by the test script that shows the Name value, the quote line and where focus is. Beta runs first. At 0:11 ⌘Z removes alpha and focus moves to the child editor, and at 0:13 ⌘⇧Z puts it back. From 0:23 slatejs.org runs the same steps, and at 0:34 ⌘Z brings back a in Name.
  • Repro 2: headless Chromium recording, 33 seconds, in the same layout. On Beta, Backspace at 0:04 deletes the 3, and ⌘Z at 0:07 leaves the input at …/2668985. From 0:16 slatejs.org runs the same steps, and ⌘Z at 0:23 restores …/26689853.
Repro 1 — Chromium, /examples/plite/editable-voids

https://github.com/user-attachments/assets/91c856a0-2eaf-4f1f-97b5-1120e05fa4d9

Repro 2 — Chromium, /examples/plite/embeds

https://github.com/user-attachments/assets/ba6ce8b8-89fd-41ae-a6f0-b483dcbafb82

主要言語
TypeScript
スター
16.6k
フォーク
993
平均マージ
20時間 2分
マージ済み PR(30日)
62

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

udecode/plate のほかの issue

udecode/plate の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。