[Beta]: Read-only editor is still an editable region: a click focuses it and right-click offers Paste

Aperta
#5,252 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
56/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
react, typescript

Direzione di ricerca

Start with packages/plitejs/src/react/components/editable.tsx at the contentEditable and read-only handling, then inspect apps/www/src/registry/components/editor/editor.tsx and html-export.tsx for the affected demos. Compare the rendered attributes and focus behavior with the Slate read-only example. Done means read-only content remains selectable and copyable without focusing as an editable region, showing a caret, or offering Cut and Paste.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug target:beta

Testing lane

  • Repository: udecode/plate
  • Branch: next
  • Release channel: Beta
  • Exact commit/package version: 7f98d46ed5 for the agent's 2026-10-21 runs, NOT_ENOUGH_INFO for the others

Summary

A read-only editor on Beta still acts as an editable region. A click moves focus into it, and right-click shows the editing menu with Cut, Paste and Paste and Match Style. In the HTML export demo the click also shows an insertion caret. No input changes the text, so the content stays read-only, but the editor looks like one you can type in. Slate's read-only example and the Slate to HTML demo on platejs.org show read-only content as static text.

Reproduction

Repro 1: /examples/plite/read-only, Chrome
  1. Open https://beta.platejs.org/examples/plite/read-only.
  2. Right-click the in This example shows what happens when the Editor is set to readOnly, it is not editable.
  3. With text on the clipboard, choose Paste. Right-click the again and choose Paste and Match Style.
  4. Click the text.

The menu in step 2 lists Cut, Copy, Paste and Paste and Match Style, with Undo and Redo grayed out. Paste and Paste and Match Style leave the text as it was. After step 4 focus is on the editor root, which reads contenteditable="true" and aria-readonly="true". On https://www.slatejs.org/examples/read-only the menu has Look Up, Copy and Search Google, with no Cut or Paste. After a click there the editor reads contenteditable="false" and focus stays on body.

Repro 2: /docs/examples/html-export, Chrome
  1. Open https://beta.platejs.org/docs/examples/html-export. The demo's preview frame is /view/html-export.
  2. In the left Editor pane, which is read-only, click the end of Heading 1.
  3. Type Q and A, then press Backspace.

After step 2 focus moves into the editor and a caret shows after Heading 1. After step 3 the text has not changed and the caret is still there. The editor root reads contenteditable="true" and aria-readonly="true", with a collapsed selection after Heading 1. On https://platejs.org/docs/examples/slate-to-html (preview frame /view/slate-to-html) the left Editor pane is read-only too, but it reads contenteditable="false". The same click shows no caret, focus stays on body, and typing changes nothing.

Expected

A read-only editor is static text, as on slatejs.org/examples/read-only and platejs.org/docs/examples/slate-to-html. A click does not move focus into it or show a caret, and right-click shows the reading menu without Cut or Paste. Selecting and copying text keeps working, as it does today in Beta's and Slate's read-only examples. natamox checked both pages by hand and counts the editable state on Beta as a bug.

Actual

Beta keeps the read-only editor root contenteditable="true" and only adds aria-readonly="true". A click focuses it, the HTML export demo shows a caret, and right-click offers Cut, Paste and Paste and Match Style. Typing, Paste and Paste and Match Style change nothing.

Environment

  • Exact next commit/Beta package version: 7f98d46ed5 for the agent's 2026-10-21 runs, NOT_ENOUGH_INFO for the others.
  • Repro 1: an agent drove desktop Chrome on macOS on 2026-10-20 (PT) and recorded the menus and both Paste runs. That Chrome version was not recorded. An agent read back the attributes and focus in Chromium 152 in an agent's browser on 2026-10-21 (PT). natamox confirmed the editable region and the Paste menu by hand in Chrome on 2026-10-21 (PT).
  • Repro 2: an agent ran the steps in Chromium 152 in an agent's browser on 2026-10-21 (PT). natamox confirmed the caret and the ignored typing by hand in Chrome the same day.
  • The Chrome version and OS of the hand checks: NOT_ENOUGH_INFO.

Caveat

  • From a reading of the code on next, not confirmed by a fix: Plite's Editable always renders contentEditable (packages/plitejs/src/react/components/editable.tsx:531), and read-only only adds aria-readonly (:516). Its default style hides the caret with caretColor: 'transparent' when read-only (:553). Plate's registry Editor passes disableDefaultStyles (apps/www/src/registry/components/editor/editor.tsx:132), which drops that style. The HTML export pane renders <EditorRoot readOnly> with that Editor (apps/www/src/registry/components/editor/html-export.tsx:97). By this reading, that is why repro 2 shows a caret. Slate's Editable writes contentEditable={!readOnly}.
  • The code comment beside the caret style says read-only editors stay selectable without a caret, so the editable root may be on purpose. Nobody has checked.
  • Firefox notes for the HTML export pane only say that typing does nothing, which is the same read-only design. Whether Firefox shows the caret was not recorded.
  • #5250 is a different problem: edits get through a read-only inline element. Here the content stays read-only, but the editor still presents as editable.

Evidence

  • Repro 1, slides: 12 seconds, Beta beside slatejs.org, built from frames of the agent's Chrome recording and from the agent's readback. From 0:03 the two right-click menus: Beta's has Cut, Paste and Paste and Match Style, with Undo and Redo grayed out, and Slate's has Look Up, Copy and Search, with no Paste. From 0:08 the readback after a click in the text: Beta reads contenteditable="true" and aria-readonly="true" with focus on the editor root, and Slate reads contenteditable="false" with focus on body.
  • Repro 1, menu recording: the agent's Chrome screen recording, 20 seconds, with English captions. The browser's profile button is blurred. Slate's menu shows from 0:01. Beta's menu shows from 0:06. Paste is chosen at 0:10 and Paste and Match Style at 0:17, and the text stays the same both times.
  • Repro 2, slides: 15 seconds, Beta beside platejs.org, built from the agent's screenshots. At 0:03 the click: Beta shows a caret after Heading 1, and platejs.org shows none. At 0:07, after the typing, the text is unchanged on both sites and Beta's caret is still there. From 0:11 the readback: Beta reads contenteditable="true" and aria-readonly="true" with focus on the editor root, and platejs.org reads contenteditable="false" with focus on body.
Repro 1 — Chrome, /examples/plite/read-only

https://github.com/user-attachments/assets/a21163df-3363-4a84-b48d-3389e26749e0

Repro 1 — Chrome, /examples/plite/read-only (menu recording)

https://github.com/user-attachments/assets/a9f67d47-d011-41c2-9274-6ad72b2d0036

Repro 2 — Chromium, /docs/examples/html-export

https://github.com/user-attachments/assets/89af4709-5f5f-43bf-91e4-44e138c02188

Lingua principale
TypeScript
Stelle
16.6k
Fork
993
Merge medio
20h 2m
PR unite (30g)
62

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di udecode/plate

Tutte le issue di udecode/plate

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.