Open Bug 1466417 Opened 6 years ago Updated 2 years ago

Copy/paste in contenteditable span pastes the element itself instead of content

Categories

(Core :: DOM: Editor, defect, P3)

61 Branch
x86
Windows 10
defect

Tracking

()

UNCONFIRMED

People

(Reporter: jeansebastienpwarr, Unassigned, NeedInfo)

References

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0
Build ID: 20180530184300

Steps to reproduce:

Copy then paste in contenteditable span (<span contenteditable="true">text</span>).
I know there is this topic : https://bugzilla.mozilla.org/show_bug.cgi?id=436703
but my message seems to not have been seen.


Actual results:

It pastes the element itself.


Expected results:

It should pastes the selected content of the element.
Proof : https://codepen.io/JNa0/pen/OZbaOO
Hi,

I've tried to reproduce the issue mentioned above using the latest Nightly 62.0a1 Build ID:20180605220158 on Win10 x64, also compared it with the latest Chrome release and the results were the same. Can you give us a screen recording, just to make sure that we understand the correct issue (you can use this app for screen recording https://www.screenpresso.com/)?

I'm assigning a component to have a second opinion from the development team about the expected behavior.
Component: Untriaged → Editor
Flags: needinfo?(jeansebastienpwarr)
OS: Unspecified → Windows 10
Product: Firefox → Core
Hardware: Unspecified → x86
See Also: → 436703
Here is my screenshot :
https://screenpresso.com/=5BU0d

If you select text content in a contenteditable span (not p tag) then copy it, it copies the element itself (with its attributes) with the selected text as content instead of just copy the selected text.

Then when you paste, it puts the copied element (indifferently of the contenteditable element in which you paste).

You can also see that if you try to copy text in a pasted span into the root one, it copies each parent span up to the root one but not their text content and other child elements.

Note :
I tried also with pre and code tags (not in the video) and exactly the same bug appears.
P tag is an exception : it doesn't copies and pastes itself when you copy in a contenteditable p tag ; but it permits to paste elements into it and to copy pasted elements into it.

So is it really a bug or just a (weird) feature ?
Flags: needinfo?(jeansebastienpwarr)
could you attach a sample by comment #2?
Flags: needinfo?(jeansebastienpwarr)
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.