Skip to content

Fix copypasting from responses page resulting in wrong paragraph/newline placement#3328

Merged
Chartman123 merged 1 commit into
mainfrom
fix/copypaste-results
May 11, 2026
Merged

Fix copypasting from responses page resulting in wrong paragraph/newline placement#3328
Chartman123 merged 1 commit into
mainfrom
fix/copypaste-results

Conversation

@jancborchardt
Copy link
Copy Markdown
Member

Fix #975, as it is a recurring annoyance I have. :D

I often copy individual submissions directly from the responses/results view of a form, without going through the structured process of creating a spreadsheet or exporting it.

While the visual styling of the responses looks good, what comes out when copying it and pasting it as plain text has empty lines in the wrong places.

Visually it looks like this on the responses/results page:

admin
Monday, May 11, 2026 2:21 PM

Short answer question title
Just testing a reply

Long text question title
Testing a reply for the long text

Checkbox question title
I love the Forms app

But when copy-pasting it from the page into a text editor, it comes out like this:

admin

Monday, May 11, 2026 2:21 PM
Short answer question title

Just testing a reply
Long text question title

Testing a reply for the long text
Checkbox question title

I love the Forms app
Before After
Screenshot From 2026-05-11 14-22-23 Screenshot From 2026-05-11 16-07-54

AI-assisted: Claude Code (Sonnet 4.6)

The key insight: browsers give h1–h6 elements a special extra newline in clipboard text regardless of CSS. The new serializeNode method walks the actual DOM selection and treats all
block elements — including headings — uniformly (one newline each). The .answer div gets a leading \n to produce the blank line separator between questions, matching the visual
layout.

This means:

  • Whole submission copy → same nicely formatted output as before
  • Partial copy (e.g. half a question title + half its answer) → exactly that text, no extra blank line
  • Single answer copy → just that question title + answer
  • The exact character boundaries of what the user selected are respected throughout

@jancborchardt jancborchardt self-assigned this May 11, 2026
@jancborchardt jancborchardt added enhancement New feature or request javascript Javascript related ticket 3. to review Waiting for reviews papercut Annoying recurring issue with possibly simple fix. feature: 📊 responses & statistics labels May 11, 2026
@jancborchardt jancborchardt moved this to 🏗️ At engineering in 🖍 Design team May 11, 2026
@Chartman123
Copy link
Copy Markdown
Collaborator

@jancborchardt thanks for the contribution :) Just some prettier issues left in the code. Other than that it looks good from my side.

…ine placement, fix #975

AI-assisted: Claude Code (Sonnet 4.6)
Signed-off-by: Jan C. Borchardt <925062+jancborchardt@users.noreply.github.com>
@jancborchardt jancborchardt force-pushed the fix/copypaste-results branch from af9ee8e to 46f57b2 Compare May 11, 2026 15:24
Copy link
Copy Markdown
Member Author

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Chartman123 ah sorry, forgot to run the linter! :) Did now and issues are fixed.

@Chartman123 Chartman123 added this to the 5.3 milestone May 11, 2026
@Chartman123 Chartman123 merged commit d6b5d12 into main May 11, 2026
43 checks passed
@github-project-automation github-project-automation Bot moved this from 🏗️ At engineering to 🎉 Done in 🖍 Design team May 11, 2026
@Chartman123 Chartman123 deleted the fix/copypaste-results branch May 11, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews enhancement New feature or request feature: 📊 responses & statistics javascript Javascript related ticket papercut Annoying recurring issue with possibly simple fix.

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

Copy-paste of results has empty lines in wrong space

2 participants