Open Bug 1170275 Opened 9 years ago Updated 3 years ago

Copy event doesn't fire in certain conditions

Categories

(Core :: DOM: Events, defect, P5)

38 Branch
x86
Windows 7
defect

Tracking

()

UNCONFIRMED

People

(Reporter: stefan.hahn, Unassigned)

References

()

Details

(Keywords: testcase)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0
Build ID: 20150513174244

Steps to reproduce:

The problem occurs when intercepting Ctrl + A keypress to mark only a certain area of the page and then ntercepting copy event to modify the selected text before writing to clipboard.

Example can be found here: https://jsfiddle.net/qu375bpa/1/

First, you have to attach a copy event listener on a wrapper element. This is the area Ctrl + A should mark. See below. This listener prevents the default action, gets the selected area and writes custom data to event.clipboardData as an example for selection modfication before written to clipboard.

The second listener is a keypress listener on document to intercept the Ctrl + A key press. I checks for Ctrl + A specifically so it doesn't do anything when another modifier key is pressed.
If it's Ctrl + A, default action is prevented and the wrapper element is added to a Selection range. This range is then used to select this certain area in the document when the user presses Ctrl + A.


Actual results:

Now what happens when you press Ctrl + A and try to copy the selected area. You just get the selected text copied to clipboard But this is not what should have happened.


Expected results:

Actually you should end up with the computed clipboard content written by the copy event handler in your clipboard. Because the copy listener is registered on the wrapper element and the selected area is the entire wrapper node when using Ctrl + A in the first place.
OS: Unspecified → Windows 7
Hardware: Unspecified → x86
Component: Untriaged → DOM: Events
Keywords: testcase
Product: Firefox → Core

Bulk-downgrade of unassigned, >=5 years untouched DOM/Storage bugs' priority.

If you have reason to believe this is wrong (especially for the severity), please write a comment and ni :jstutte.

Severity: normal → S4
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.