Open Bug 1562230 Opened 6 years ago Updated 2 years ago

Selection and copy of text adds a space to beginning of selection

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, defect, P3)

67 Branch
All
Unspecified
defect

Tracking

()

Tracking Status
firefox93 --- affected

People

(Reporter: ryanlantzy, Unassigned)

Details

Attachments

(1 file)

Attached file example.html

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36

Steps to reproduce:

  1. Load an website or HTML file with text content in the body tag that has two spaces between two text elements. E.g. "FirstTextElement SecondTextElement"

  2. Double click on the second text element

  3. Right click copy (or Ctrl+C on Windows)

  4. Paste the selection to a text editor

Actual results:

The second text element is selected visually, with no leading space. However when the selection is pasted elsewhere, a leading space is carried with it.

Expected results:

The actual copied selection should match the visual text selection with no space.

Component: Untriaged → Selection
Product: Firefox → Core

Thanks for reporting this bug. AFAICT, there is no specification to address this behavior, we should consider put into specification make it align with all browsers.

Test result:
Mozilla/Nightly 69.0a1 (Window 10 x64), it has a leading space after pasted to a text editor. ex: " SecondTextElement".
Edge/17.17134 (Window 10 x64), it has a tail space after pasted to a text editor. ex: "SecondTextElement ".
Chrome/75.0.3770.100 (Window 10 x64) and Safari/537.36 (Window 10 x64) match the visual text selection with no space.

Hi :masayuki,
Could you help to take a look? Thank you.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(masayuki)
Priority: -- → P3

Hmm, doubleclick causes selecting start from second space of previous word. I don't think this should be standardized but this behavior is odd.

Flags: needinfo?(masayuki)

Note when having three (instead of two) whitespaces in the html file, also only one additional whitespace is copied.

Component: DOM: Selection → DOM: Copy & Paste and Drag & Drop
Hardware: Unspecified → All
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: