Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366312 - [firefox] right-clicking outside of the selection causes the caret to move
Summary: [firefox] right-clicking outside of the selection causes the caret to move
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Editor (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 0.4 M2   Edit
Assignee: Mihai Sucan CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-10 11:31 EST by Mihai Sucan CLA
Modified: 2012-01-20 15:04 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mihai Sucan CLA 2011-12-10 11:31:50 EST
STR:

1. open Orion.
2. make a selection or place the caret anywhere you want in the document.
3. right-click on a different line.

Expected result: nothing happens.

Actual result: the text color of the selection changes and the caret moves to the mouse location.

Cause: the right click event is not prevented, the caret location changes and the DOM selection is lost (hence the text color of the selection changes).

This is caused by Mozilla bug 709476:
https://bugzilla.mozilla.org/show_bug.cgi?id=709476
Comment 1 Mihai Sucan CLA 2011-12-10 11:59:59 EST
Proposed change:

https://github.com/mihaisucan/orion.client/tree/bug-366312

We can't use preventDefault(), so the only solution I came up with was to update the DOM selection when needed.

Please let me know if further changes are needed. Thank you!
Comment 2 Felipe Heidrich CLA 2011-12-12 16:46:17 EST
Looks fine, not sure I would worry about the "if (timeDiff <= this._clickTime)" test, 

go ahead and release it.

Thank you
Comment 3 Mihai Sucan CLA 2011-12-13 12:48:33 EST
(In reply to comment #2)
> Looks fine, not sure I would worry about the "if (timeDiff <= this._clickTime)"
> test, 
> 
> go ahead and release it.

Thank you for reviewing the code!

Landed:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=ea880f5922f1bcdf09fd5fa1e9d238355d36cf89

The timeDiff check is needed for when you right-click then you press the contextmenu key after some long delay. The workaround to call _updateDOMSelection() is only needed when the context menu is invoked from right-click within the allocated time.