André Bargull wrote:
Ok, let's see what we've got:

(1) You've added this line to "__mouseEvent()":
 > > if (e.button == 2 && eventname != 'oncontextmenu') return;
So the event processing is stopped for any event with "button==2" (unless the eventname is "oncontextmenu" -> btw, when does this happen? There is no listener attached to the click divs for "oncontextmenu"..).

It shouldn't ever happen, because as you point out the oncontextmenu is
only sent from the document.

(2) And earlier, the bubbling is already stopped when calling "__keybardEvent()", because "event.keyCode" is >=0 (at least for Safari,
Opera, IE).

(3) And just for "onmouseup" the event bubbling is reenabled.


My questions:
I suppose you're testing with Safari, right? May you test if "keyCode" is >=0 for every mouse-event? Because in that case the event bubbling is stopped by (2). And "onmouseup" events with right button won't be reenabled (3) because of (1).

Actually, I was testing under Firefox OS X. Safari OS X has different issues with this patch - the context menu sends onmouseup events but no onmousedown - leading to issues with dragging.

We really need to get you a hackintosh or something so you can test on OS X!

On 5/20/2009 12:33 AM, Max Carlson wrote:
Nope, that doesn't do it. I think it has to do with the fact that onmouseup events no longer bubble...

André Bargull wrote:
Hm, it works for me perfectly on Windows (IE, Firefox, Safari).
Do you get different results if you replace in "__clickDispatcher()":
e.preventDefault();
e.stopPropagation();

with:
e.returnValue = false;
e.cancelBubble = true;
?




On 5/19/2009 11:26 PM, Max Carlson wrote:
Not approved. In OS X, test/contextmenu/lpp-6980.lzx no longer shows context menus for the red or blue boxes. If I change LzMouseKernel.js as follows, everything works again:

46c46
< } else if (eventname == 'oncontextmenu' || (e.button == 2 && eventname == 'onmouseup') ) {
---
> } else if (eventname == 'oncontextmenu' || (e.button == 2 && eventname == 'onclick') ) {

André Bargull wrote:
Change 20090519-bargull-2Mz by barg...@dell--p4--2-53 on 2009-05-19 19:41:02
in /home/Admin/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: DHTML: contextmenu part two

New Features:

Bugs Fixed: LPP-8189 (Right click fires an erroneous mousedown and mouseup in DHTML) (partial)

Technical Reviewer: max
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
LzSprite:
- canceling event-bubbling for all mouse-events => this was already done for all browsers (except Firefox) and all events (except onmouseup). Why wasn't Firefox affected? => All other browsers set "event.keyCode" to '0' for mouse-events, only Firefox sets "keyCode" to 'undefined'. Now take a look at "LzKeyboardKernel.__keyboardEvent()", every event was canceled in that function if "keyCode" was '>= 0'!

LzKeyboardKernel:
- move handling for control keys (ctrl, shift, alt) into separate function. It should be obvious why having a single function for both, mouse-events and keyboard-events, is a bad idea (see keyCode issue from above).


Tests:

Files:
M WEB-INF/lps/lfc/kernel/dhtml/LzKeyboardKernel.js
M WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
M WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20090519-bargull-2Mz.tar




--
Regards,
Max Carlson
OpenLaszlo.org



Reply via email to