I'm lost.  I think this is the correct behavior for a context menu:

A) mouse-right-down:  show context menu

   holding the mouse down, you can drag to select a menu item, and  
release to select it, or select nothing and release to hide the menu.

B) mouse-right-down/mouse-right-up (i.e., mouse-right-click):  show  
context menu

   now you can drag to select a menu item, and mouse-left-click to  
select it, or select nothing (move out of the menu) and mouse-left- 
click to hide the menu.

So, am I understanding that the issue is that in case B, clicking  
outside the menu is sending mouse events in some browsers but not  
others?

If we want to head off these events, isn't the right thing to do to  
intercept the event in "capture" phase (3rd argument to  
addEventListener `true`), and stop propagation there, before it gets  
to any element?  So, we could have a capturing handler that looks for  
mouse events, and when the context menu is shown but is not the target  
of the mouse event, we stop its propagation (but allow the default,  
which would be to dismiss the context menu).


On 2009-08-31, at 22:51, Henry Minsky wrote:

> Yeah, but the behavior in SWF8 on windows and OSX is different.
>
> The case that I'm dealing with  is if the user
>
> 1) brings up a context menu
> 2)  does not mouse down on any context menu item
> 3)  then moves the mouse outside of the context menu and clicks left
>
>
> In Firefox, on Windows you get  mousedown/mouseup/click events sent  
> to the
> view, but in OSX, you don't get any mouse events.  In IE7, you get
> mousedown/mouseup events but no click event.
>
> So, it seems pretty hard to get all these cases to match, even in  
> swf; maybe
> there is a
> "ideal" behavior we should be trying to nudge things into as we get  
> the
> opportunities. I was thinking
> of the user who popped up a context menu just to look at it, but  
> then wants
> to dismiss it
> without affecting anything, so I was looking for ways to discard the  
> mouse
> events associated
> with that gesture.  And it happened that I was referring to the  
> behavior of
> swf8 in OSX, which is
> unfortunately different from Windows...
>
>
>
>
>
>
>
>
>
> On Mon, Aug 31, 2009 at 7:38 PM, Max Carlson <[email protected]>  
> wrote:
>
>> Shouldn't the events match the swf8 behavior?
>>
>> Henry Minsky wrote:
>>
>>> Hmm, the behavior in Firefox/SWF on Windows and OSX is quite  
>>> different. In
>>> OSX, I don't get
>>> any mouse events on the view, in case b), and also don't get any  
>>> of the
>>> global mouse events.
>>>
>>> Would you approve this change as an improvement over the existing
>>> behavior?  The thing
>>> I'm most worried about is in DHTML having unwanted mouse click  
>>> events on
>>> views
>>> when people try to dismiss a context menu without choosing any  
>>> items.
>>>
>>>
>>>
>>>
>>> On Mon, Aug 31, 2009 at 6:57 PM, André Bargull  
>>> <[email protected]<mailto:
>>> [email protected]>> wrote:
>>>
>>>   I've tested
>>>   a) right clicking on canvas and then left clicking on canvas
>>>   b) right clicking on red view and then left clicking on red view
>>>   a) right clicking on canvas and then left clicking on red view
>>>   b) right clicking on red view and then left clicking on canvas
>>>
>>>   swf8-results:
>>>   a)
>>>   DEBUG: global onmousedown
>>>   DEBUG: global onmouseup
>>>   b)
>>>   DEBUG: global onmousedown
>>>   DEBUG: view onmousedown
>>>   DEBUG: global onmouseup
>>>   DEBUG: view onmouseup
>>>   DEBUG: view onclick
>>>   c)
>>>   DEBUG: global onmousedown
>>>   DEBUG: view onmousedown
>>>   DEBUG: global onmouseup
>>>   DEBUG: view onmouseup
>>>   DEBUG: view onclick
>>>   d)
>>>   DEBUG: global onmousedown
>>>   DEBUG: global onmouseup
>>>
>>>   dhtml (Firefox3.5, Win)
>>>   a) none
>>>   b) DEBUG: global onmouseup
>>>   c) DEBUG: global onmouseup
>>>   d) none
>>>
>>>   Note: the global mouseup-events in dhtml may be triggered by  
>>> LPP-8423
>>>
>>>
>>>
>>>
>>>   On 8/31/2009 7:09 PM, Henry Minsky wrote:
>>>
>>>       Change 20090831-hqm-N by [email protected] on 2009-08-31
>>>       13:01:15 EDT
>>>          in /Users/hqm/openlaszlo/trunk-clean
>>>          for http://svn.openlaszlo.org/openlaszlo/trunk
>>>
>>>       Summary: (DHTML) ignore spurious mouse events when user
>>>       dismisses contextmenu
>>>
>>>       New Features:
>>>
>>>       Bugs Fixed: LPP-8218, LPP-8189
>>>
>>>       Technical Reviewer: max
>>>       QA Reviewer: andre
>>>       Doc Reviewer: (pending)
>>>
>>>       Documentation:
>>>
>>>       Release Notes:
>>>
>>>       Details:
>>>
>>>       Change to make behavior when menu is dismissed match SWF more
>>>       closely.
>>>
>>>       + When the user wants to dismiss a context menu without
>>>       selecting any
>>>       items, they move the mouse outside of the menu and either
>>>       release the
>>>       button or click the button.  In either case, we do not want  
>>> these
>>>       mousedown,mouseup, and click events to be sent to whatever  
>>> view
>>> they
>>>       happen to be over.
>>>
>>>       This change modifies LzMouseKernel#__sendEvent to check if the
>>>       context
>>>       menu is being hidden due to a mousedown, and if so, sets  
>>> flags to
>>>       ignore the next mouseup and onclick events.
>>>
>>>
>>>       Tests:
>>>
>>>       [test case from LPP-8189]
>>>       <canvas>
>>>       <view width="200" height="200" bgcolor="0xff0000">
>>>          <handler name="onmousedown">
>>>              // Expected: Fires in swf8 and dhtml for left mouse  
>>> click
>>>              // Unexpected: Fires in dhtml for right mouse click
>>>              Debug.write("onmousedown");
>>>          </handler>
>>>          <handler name="onmouseup">
>>>              // Expected: Fires in swf8 and dhtml for left mouse  
>>> click
>>>              // Unexpected: Fires in dhtml for right mouse click
>>>              Debug.write("onmouseup");
>>>          </handler>
>>>          <handler name="onclick">
>>>              // Expected: Fires in swf8 and dhtml for left mouse  
>>> click
>>>              Debug.write("onclick");
>>>          </handler>
>>>       </view>
>>>       </canvas>
>>>
>>>
>>>       In DHTML, these two cases should print no mouse events to the
>>>       debugger
>>>
>>>       [1] Move mouse over red view, click right to display context  
>>> menu.
>>>       Press left button over an item, and while holding, drag  
>>> mouse out
>>> of
>>>       context menu, but still over the red view, and then release
>>>       button to
>>>       dismiss menu.
>>>       No events should print to the debugger.
>>>
>>>       [1] Move mouse over red view, click right to display context  
>>> menu.
>>>       Move mouse out of context menu, but still over red view, and  
>>> click
>>>       left to dismiss menu.
>>>       No events should print to the debugger.
>>>
>>>       Files:
>>>       M      WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js
>>>
>>>       Changeset:
>>>       http://svn.openlaszlo.org/openlaszlo/patches/20090831-hqm- 
>>> N.tar
>>>
>>>
>>>
>>>
>>> --
>>> Henry Minsky
>>> Software Architect
>>> [email protected] <mailto:[email protected]>
>>>
>>>
>>>
>> --
>> Regards,
>> Max Carlson
>> OpenLaszlo.org
>>
>
>
>
> -- 
> Henry Minsky
> Software Architect
> [email protected]
> _______________________________________________
> Laszlo-reviews mailing list
> [email protected]
> http://www.openlaszlo.org/mailman/listinfo/laszlo-reviews


_______________________________________________
Laszlo-reviews mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-reviews

Reply via email to