Closed
Bug 1159490
Opened 10 years ago
Closed 10 years ago
Dispatch the clipboard events unconditionally when the user presses Ctrl+C/X/V even if the commands are disabled
Categories
(Core :: DOM: Events, defect)
Core
DOM: Events
Tracking
()
RESOLVED
FIXED
mozilla41
Tracking | Status | |
---|---|---|
firefox41 | --- | fixed |
People
(Reporter: ehsan.akhgari, Assigned: nika)
References
(Depends on 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
neil
:
review+
|
Details | Diff | Splinter Review |
This was discussed in <https://groups.google.com/forum/#!searchin/mozilla.dev.webapi/execcommand$20copy$20paste/mozilla.dev.webapi/Bvb-S152azI/APi3o1XoSsgJ>.
I think we need to fix goDoCommand to not check whether these commands are enabled before invoking them, and fix the command controllers to say they are always enabled in order for things such as menu items and toolbar buttons to remain enabled...
There's probably some details missing from this brief description.
Reporter | ||
Updated•10 years ago
|
Assignee: nobody → michael
Reporter | ||
Updated•10 years ago
|
Assignee | ||
Comment 1•10 years ago
|
||
Attachment #8604215 -
Flags: review?(ehsan)
Reporter | ||
Comment 2•10 years ago
|
||
Comment on attachment 8604215 [details] [diff] [review]
Allow cut/copy event dispatch unconditionally in HTML documents
Review of attachment 8604215 [details] [diff] [review]:
-----------------------------------------------------------------
This looks fine to me, but I would like Neil to take a look at it as well.
::: toolkit/content/tests/chrome/bug366992_window.xul
@@ +47,1 @@
> .getAttribute("disabled") == "true";
Nit: please fix the indentation.
Attachment #8604215 -
Flags: review?(neil)
Attachment #8604215 -
Flags: review?(ehsan)
Attachment #8604215 -
Flags: review+
Assignee | ||
Comment 3•10 years ago
|
||
Fixed indentation
Attachment #8604215 -
Attachment is obsolete: true
Attachment #8604215 -
Flags: review?(neil)
Attachment #8605301 -
Flags: review?(neil)
Updated•10 years ago
|
Attachment #8605301 -
Flags: review?(neil) → review+
Keywords: checkin-needed
Comment 6•10 years ago
|
||
Updated•10 years ago
|
Keywords: dev-doc-needed
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
Comment 8•9 years ago
|
||
Er, isn't this meant to apply only when focus is in an html document? I am very strongly opposed to change if not. This (or the other bug) has made the cut/copy command enabled all the time, even if, for example, a button in the preference window is focused, which is certainly wrong.
I filed bug 1170531 on this.
Comment 9•9 years ago
|
||
Yeah, looking at the patch, this isn't the right way to fix this. There's a controller in nsGlobalWindowCommands.cpp for each window that handles whether the command should be enabled when something non-editable is focused. For editable contexts such as <input> there's a different one in nsEditorCommands.cpp
What I think you actually want is just make nsClipboardCommand::IsCommandEnabled return true unconditionally for html documents. (or perhaps for things that are not xul documents). This gets called whenever something happens that could affect the clipboard command state.
Updated•9 years ago
|
Keywords: dev-doc-needed
Comment 10•9 years ago
|
||
Unfortunately, paste event is still not fired in Firefox 41 if the page has no editable element.
Test case:
open https://bugzilla.mozilla.org/attachment.cgi?id=8605301 , and open dev tools;
run this code `addEventListener('paste', function() {console.log('paste')})`;
copy something and press Ctrl+V in the page.
Expected:
console shows 'paste'.
Actually:
nothing is shown.
Assignee | ||
Comment 11•9 years ago
|
||
(In reply to Duan Yao from comment #10)
> Unfortunately, paste event is still not fired in Firefox 41 if the page has
> no editable element.
>
> Test case:
>
> open https://bugzilla.mozilla.org/attachment.cgi?id=8605301 , and open dev
> tools;
> run this code `addEventListener('paste', function() {console.log('paste')})`;
> copy something and press Ctrl+V in the page.
>
> Expected:
>
> console shows 'paste'.
>
> Actually:
>
> nothing is shown.
It appears as though at some point when fixing the menu items I regressed addEventListener('paste') on documents without an editor - if there is a `<div contenteditable>` on the page, everything seems to work correctly...
I filed bug 1208217 about it.
You need to log in
before you can comment on or make changes to this bug.
Description
•