Jesse MacFadyen created CB-953:
----------------------------------
Summary: mousedown and mouseup events are fired twice
Key: CB-953
URL: https://issues.apache.org/jira/browse/CB-953
Project: Apache Cordova
Issue Type: Bug
Components: WP7
Affects Versions: 1.7.0
Reporter: Jesse MacFadyen
Assignee: Jesse MacFadyen
Fix For: 1.9.0
I have a simple Cordova 1.7.0. test app that just handles mouse events and logs
event target (attached). I found out that mousedown and mouseup events are
fired twice. First time they are fired in code by C# InvokeSimulatedMouseEvent
function and the second time by WebBrowser control itself. That leads to event
handlers also to be called twice for each event.
I found out that the second time WebBrowser fires events because native Tap
event is not prevented. So I added tap handler that prevents event bubbling in
order to illuminate unnecessary event firing:
private void browser_Loaded(object sender, RoutedEventArgs e)
{
…
border.Tap += Border_Tap;
…
}
void Border_Tap(object sender, GestureEventArgs e)
{
e.Handled = true;
}
In this case events are fired only once, but I have the following issues:
a. After clicking on input field it is highlighted but virtual keyboard
is not opened.
b. Play button of audio element becomes not clickable.
It seems that all events are fired correctly but there are some little
difference between system and Cordova events (see below):
Cordova generated:
Log:"isCordova=true; fromElement=null; layerX=0; layerY=0; toElement=null;
which=1; altKey=false; button=0; buttons=0; clientX=233; clientY=209;
ctrlKey=false; metaKey=false; offsetX=0; offsetY=0; pageX=233; pageY=209;
relatedTarget=[object HTMLInputElement]; screenX=233; screenY=209;
shiftKey=false; x=0; y=0; getModifierState=\nfunction getModifierState() {\n
[native code]\n}\n; initMouseEvent=\nfunction initMouseEvent() {\n [native
code]\n}\n; detail=1; view=[object Window]; initUIEvent=\nfunction
initUIEvent() {\n [native code]\n}\n; bubbles=true; cancelable=true;
currentTarget=[object Window]; defaultPrevented=false; eventPhase=1;
isTrusted=false; target=[object HTMLInputElement]; timeStamp=1The thread '<No
Name>' (0xf3204da) has exited with code 0 (0x0).
Log:"isCordova=true; fromElement=null; layerX=0; layerY=0; toElement=null;
which=1; altKey=false; button=0; buttons=0; clientX=233; clientY=209;
ctrlKey=false; metaKey=false; offsetX=0; offsetY=0; pageX=233; pageY=209;
relatedTarget=[object HTMLInputElement]; screenX=233; screenY=209;
shiftKey=false; x=0; y=0; getModifierState=\nfunction getModifierState() {\n
[native code]\n}\n; initMouseEvent=\nfunction initMouseEvent() {\n [native
code]\n}\n; detail=1; view=[object Window]; initUIEvent=\nfunction
initUIEvent() {\n [native code]\n}\n; bubbles=true; cancelable=true;
currentTarget=[object Window]; defaultPrevented=false; eventPhase=1;
isTrusted=false; target=[object HTMLInputElement]; timeStamp=1Log:"trace end"
System:
Log:"fromElement=null; layerX=67; layerY=20; toElement=null; which=1;
altKey=false; button=0; buttons=1; clientX=233; clientY=209; ctrlKey=false;
metaKey=false; offsetX=67; offsetY=20; pageX=233; pageY=209;
relatedTarget=null; screenX=1345; screenY=1309; shiftKey=false; x=67; y=20;
getModifierState=\nfunction getModifierState() {\n [native code]\n}\n;
initMouseEvent=\nfunction initMouseEvent() {\n [native code]\n}\n; detail=1;
view=[object Window]; initUIEvent=\nfunction initUIEvent() {\n [native
code]\n}\n; bubbles=true; cancelable=true; currentTarget=[object Window];
defaultPrevented=false; eventPhase=1; isTrusted=true; target=[object
HTMLInputElement]; timeStamp=1338888750791; type=mousedown;
Log:"-------------->"
Log:"fromElement=null; layerX=67; layerY=20; toElement=null; which=1;
altKey=false; button=0; buttons=1; clientX=233; clientY=209; ctrlKey=false;
metaKey=false; offsetX=67; offsetY=20; pageX=233; pageY=209;
relatedTarget=null; screenX=1345; screenY=1309; shiftKey=false; x=67; y=20;
getModifierState=\nfunction getModifierState() {\n [native code]\n}\n;
initMouseEvent=\nfunction initMouseEvent() {\n [native code]\n}\n; detail=1;
view=[object Window]; initUIEvent=\nfunction initUIEvent() {\n [native
code]\n}\n; bubbles=true; cancelable=true; currentTarget=[object Window];
defaultPrevented=false; eventPhase=1; isTrusted=true; target=[object
HTMLInputElement]; timeStamp=1338888751251; type=mouseup; caThe thread '<No
Name>' (0xe23073a) has exited with code 0 (0x0).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira