Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Beta]: In the DOM Coverage Boundaries example, Select all and Copy give different, malformed text with sections collapsed and expanded

Aperta
#5,266 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
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
playwright, react, typescript
Ambito
frontend, testing

Direzione di ricerca

Start with the reproduction and the copy flow in apps/www/src/app/(app)/examples/plite/_examples/dom-coverage-boundaries.tsx and packages/plitejs/src/dom/plugin/dom-clipboard-runtime.ts; the report points to writeSelection and distinguishes the model and DOM paths. Compare the payloads with sections collapsed and expanded, then check existing clipboard tests for coverage. Done means Select all yields consistent block text without section labels or internal editor attributes in either state.

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: NOT_ENOUGH_INFO

Summary

On /examples/plite/dom-coverage-boundaries, the page's Copy button gives a different payload for Select all when the sections are collapsed than when they are expanded, and both versions are malformed. Collapsed, the text of the collapsed sections runs together on one line in text/plain, and text/html is one <span> around the same text. Expanded, text/plain has no line break after the header, includes the section labels Outer section, Nested section and Deep section and extra blank lines, and text/html is the editor's own DOM with internal attributes.

Reproduction

Repro 1: /examples/plite/dom-coverage-boundaries, Chromium

The buttons are in the row under the page title: Header, Outer, Nested, Deep, Footer, Update hidden body, Select hidden body, Select all and Copy. The copy box is the box at the bottom of the page that shows text/plain: and text/html:.

  1. Open https://beta.platejs.org/examples/plite/dom-coverage-boundaries. On a fresh page the header, the footer and the sections are hidden.
  2. Click Select all.
  3. Click Copy and scroll to the copy box.
  4. Scroll up and click Header, Footer, Outer, Nested and Deep, so everything shows.
  5. Click Select all, then Copy, and look at the copy box again.

After step 3, text/plain reads:

Visible introduction before the collapsed section.
Section summary stays mounted.Hidden alphaNested summary stays mounted.Nested hidden bodyDeep summary stays mounted.Deep hidden bodyHidden list item
Visible paragraph after the collapsed section.

text/html is a single <span> with data-editor-fragment attributes around the same text.

After step 5, text/plain reads:

Hidden header textVisible introduction before the collapsed section.
Outer section
Section summary stays mounted.
Hidden alpha
Nested section
Nested summary stays mounted.
Nested hidden body
Deep section
Deep summary stays mounted.
Deep hidden body


Hidden list item

Visible paragraph after the collapsed section.
Hidden footer text

text/html starts with <span data-editor-text-flow="true" data-editor-node="text" ...> and carries attributes such as data-editor-node-key, data-editor-path and data-editor-text-flow-reconcile-ms on its nodes. The Outer section label comes in as <div class="editor-dom-coverage-summary" contenteditable="false">Outer section</div>.

Expected

This page has no Slate reference. As the tester (natamox) expects: apart from the header and footer, which are left out by design while they are hidden, Select all copies the same text whether the sections are collapsed or expanded. Each block is on its own line, the section labels are not part of the text, and text/html holds no internal editor attributes.

Actual

Collapsed, the collapsed sections' blocks run together on one line, and text/html is one <span>. Expanded, the header runs into the next line, the three section labels and extra blank lines are added, and text/html is the editor's DOM with its internal attributes.

Environment

  • Exact next commit/Beta package version: NOT_ENOUGH_INFO. The recording's step panel names the build as Beta, next 7f2eacb6eb, deployed 2026-10-22.
  • Repro 1: headless Chromium 149.0.7827.55 on macOS, driven by Playwright. An agent recorded it at natamox's request on 2026-10-22 (PT). natamox judged it low priority.
  • The page's Copy button only shows the payload on the page. It does not write the system clipboard, and nobody checked a real ⌘C or pasted the payload anywhere.
  • Nobody has tried another browser.

Caveat

  • Nobody has traced the cause. From a reading of the code on next, the Copy button (apps/www/src/app/(app)/examples/plite/_examples/dom-coverage-boundaries.tsx:193) calls editor.api.dom.clipboard.writeSelection, the same entry point the editor's copy handler uses. When the range covers a boundary with a copy policy, such as a collapsed section, packages/plitejs/src/dom/plugin/dom-clipboard-runtime.ts:548 writes the payload from the document model. With everything expanded there is no such boundary, and :576 clones the page's DOM, which would bring in the section labels and the internal attributes. Both paths are read from the code. That the model path joins blocks without line breaks is read from the result, not traced.
  • Leaving out the hidden header and footer while they are hidden is by design: a fully hidden boundary defaults to copyPolicy = 'exclude' (packages/plitejs/src/react/components/dom-coverage-boundary.tsx:152), and a collapsed section's boundary defaults to 'model' (:37).
  • #5263 goes through the same copy function with a different failure: there nothing is written to the clipboard.

Evidence

  • Repro 1: headless Chromium recording, 36 seconds, with an English step panel beside the page. At 0:00 Select all is clicked. At 0:04 Copy is clicked, and from 0:05 the copy box shows the collapsed payload with the run-together line and the one-<span> HTML. From 0:08 the page scrolls up and the five buttons are clicked. At 0:15 Select all is clicked again, and at 0:19 Copy. From 0:20 the copy box shows Hidden header textVisible introduction…, the three section labels, the blank lines and the HTML with data-editor-* attributes. From 0:26 the panel shows the result to the end.
Repro 1 — Chromium, /examples/plite/dom-coverage-boundaries

https://github.com/user-attachments/assets/3fdd2b38-4a28-4fca-be35-5b708cdaaae9

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

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.