[Laszlo-dev] For Review: Change 20090516-bargull-GQn Summary: once more contextmenus for dhtml
André Bargull
andre.bargull at udo.edu
Sun May 17 05:33:18 PDT 2009
I've updated the changeset to handle a few special cases for keyboard
activation and contextmenu item selection (LPP-8203, LPP-8204). And two
small changes for better swf-compatibility (LPP-8201, LPP-8202).
Change 20090516-bargull-GQn by bargull at dell--p4--2-53 on 2009-05-16 17:15:31
in /home/Admin/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: once more contextmenus for dhtml
New Features:
Bugs Fixed: LPP-8189 (Right click fires an erroneous mousedown and
mouseup in DHTML.), LPP-8142 (On a mac right click using two finger tap
on the trackpad doesn't register as right click, it registers as left
click), LPP-8201 (DHTML: hidden contextmenu item shows separator),
LPP-8202 (DHTML: possible to change an active contextmenu), LPP-8203
(DHTML: contextmenu isn't displayed after mouse left application),
LPP-8204 (DHTML: browser contextmenu is displayed)
Technical Reviewer: max
QA Reviewer: henry
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
LzContextMenuKernel:
- remove "__sentshowevent", it didn't work properly (consider this:
right to open contextmenu, then right click again => __sentshowevent is
still set => no onmenuopen event)
- remove listeners to onmousedown, onmouseup, onclick from
anchor-elements, this didn't work in Firefox. Instead add handlers to
lzcontextmenu-div
- only show contextmenu if "showbuiltins" isn't set
- remove ignore-arg from __hide(), no longer needed
LzSprite:
- add quirk for Safari, because middle mouse button click sends
onclick-event
- 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'!
- only handle onmousedown/onmouseup for left button
- if right button is clicked, delegate onmouseup event to LzMouseKernel
to show contextmenu
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).
LzMouseKernel:
- hide contextmenu on "onmousedown", not "onclick". Because it's
compliant with swf and if you drag the mouse, you don't get an
"onclick"-event, so drag and click won't hide the contextmenu
- again, only onmousedown/onmouseup for left button
- and show contextmenu if right button is clicked
UPDATE:
LzSprite:
- Handle contextmenu for keyboard activation (see "onmouseover" handler
for root-sprite's div)
LzContextMenuKernel:
- Move contextmenu-div into separate method and store reference to the
div, so you don't need to use getElementById() over and over again
- only select contextmenu item on left button click
LPP-8201: Add separator after checking for double contextmenu items
(LzContextMenuKernel#__show())
LPP-8202: Remove implementation of LzContextMenuKernel#addItem(..),
#clearItems(). It was added for LPP-6749, but the right fix is to call
the contextmenu delegate before displaying the contextmenu (see above).
Now you can also remove the "send" parameter from "__show(..)".
LPP-8203: In LzSprite#__mouseEvent(..), call the "onmouseover"
event-handler from the root-sprite's div, if the mouse entered the
application.
LPP-8204: Fixed by the handlers added to the lzcontextmenu-div (see
above) and the updated keyboard activation code to handle the
contextmenu-div
Tests:
see tests from bugreports (IE, Firefox, Safari, Opera)
Files:
M WEB-INF/lps/lfc/kernel/dhtml/LzKeyboardKernel.js
M WEB-INF/lps/lfc/kernel/dhtml/LzContextMenuKernel.lzs
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/20090516-bargull-GQn.tar
More information about the Laszlo-dev
mailing list