[Laszlo-dev] What was the reason for cancelling the events with keycode == 0 ?
Max Carlson
max at laszlosystems.com
Wed Jun 3 15:00:14 PDT 2009
The canceling code was left for compatibility reasons - André mentions
in his changeset: 'this is actually wrong, see LPP-8200, but reduces
testing effort right now.'
Control keys are already being processed by
LzKeyboardKernel.__updateControlKeys() so removing this bit _shouldn't_
matter. Please test with test/lfc/legals/keyboardandmouse.lzx?lzr=dhtml
to verify. Also note it won't help with Firefox - again from André's
changeset: '"keyCode" is set to 0 for mouse-events in IE, Opera, Safari,
so you only need to test for keyCode==0 (Firefox is irrelevant in this
case, because it sets keyCode to `undefined` for mouse-events).'
I sent mail to André to confirm which one of us is supposed to finish
the change that will clean all this up...
Henry Minsky wrote:
> The last thing that is preventing text selection from working in IE7 is
> this code in the MouseKernel.__mouseEvent which
> which explicitly cancels a mouse event when it's keyCode == 0.
>
> Now, I'm trying to understand why we need this code.
>
> As I understand it, the LzKeyboardKernel.__cancelKeys flag is being set
> by the LzInputTextSprite
> when it wants to make sure that a text field does not respond to any
> mouse or keyboard events (?).
>
> In addition, the reason we're passing the mouse event at all to
> KeyboardKernel is to inspect it's keyCode field for control keys that
> might be down, but that we didn't get explicit keyboard events for.
>
> So ... if I were to remove this block of code from
> LzMouseKernel.__mouseEvent, what would
> I be breaking?
>
> It seems like if I removed this code, then in some cases input text
> fields may respond to
> mouse events when we don't want them to?
>
>
>
> // send option/shift/ctrl key events
> if (window['LzKeyboardKernel'] &&
> LzKeyboardKernel['__updateControlKeys']) {
> LzKeyboardKernel.__updateControlKeys(e);
> -
> - // FIXME: [20090602 anba] this prevents text selection, see
> LPP-8200
> - if (LzKeyboardKernel.__cancelKeys && e.keyCode == 0) {
> - e.cancelBubble = true;
> - e.returnValue = false;
> - }
>
>
>
>
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com <mailto:hminsky at laszlosystems.com>
>
>
--
Regards,
Max Carlson
OpenLaszlo.org
More information about the Laszlo-dev
mailing list