Open Bug 995961 Opened 10 years ago Updated 1 year ago

oncopy/onpaste/oncut events are not fired if there isn't a selection

Categories

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

x86_64
All
defect

Tracking

()

People

(Reporter: bugMozilla.3.nabellaleen, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0 (Beta/Release)
Build ID: 20140411030201

Steps to reproduce:

- Give the ability to an element (a DIV for example) to get the focus, with a tabIndex attribute >= 0
- Add a listener on one of the oncopy/onpaste/oncut event to this element (or add it to the body - same issue)
- Get the focus on the element (using the keyboard with "Tab" or clicking it)
- Initiate a copy/cut


Actual results:

The oncopy/oncut/onpaste event are not fired.


Expected results:

According to current works on this API, the event should be fired in any cases. The selection only impact on data which could be put in the clipboard.
(cf last draft : http://www.w3.org/TR/2014/WD-clipboard-apis-20140313/#event-types-and-details )
OS: Windows Server 2003 → Windows XP
Attached file sample html
Status: UNCONFIRMED → NEW
Component: Untriaged → DOM: Events
Ever confirmed: true
OS: Windows XP → All
Product: Firefox → Core
Version: 31 Branch → Trunk
FWIW QuirksMode considers Firefox's behavior correct and Webkit's behavior "lazy": http://www.quirksmode.org/dom/events/cutcopypaste.html

Personally if everyone had the "lazy" behavior things would be easier for me, as I could just set the contents of, and select, my hidden textarea on a 'cut' or 'copy' event, but I would like to support IE and recent Firefox so that train has sailed.
Priority: -- → P5
See Also: → 1541572
Severity: normal → S3

(I maintain CodeMirror, and landed here because users reported line-wise clipboard functionality being broken on Firefox.) I want to add that, firstly, I agree that it would be preferable if the events were fired (makes it much easier to, for example, implement line-wise cut/copy in a text editor). Secondly, it does already work this way in textareas in Firefox, suggesting that not working with plain DOM selections (including those in contenteditable) may not be an intentional decision?

Stop handling pasting is intended according to the comment. However, I think that not dispatching paste event is not intended.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: