You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Jesse MacFadyen (JIRA)" <ji...@apache.org> on 2012/06/25 22:56:44 UTC
[jira] [Commented] (CB-953) mousedown and mouseup events are fired
twice
[ https://issues.apache.org/jira/browse/CB-953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400886#comment-13400886 ]
Jesse MacFadyen commented on CB-953:
------------------------------------
I have exhausted all that I can think of to resolve this issue, and need some assistance from someone on the IE9 Mobile team.
Currently, I have done the following :
1. prevent 'click' events and generate my own 'mock' click event
result => prevents the mousedown/mouseup from firing twice
defect => Input elements not focusable
I have tried showing the keyboard by callng Element.focus() but it does not work.
Another problem with this approach is that by preventing the built-in click events we lose other interactions, like selecting text for copy paste operations.
One possible work around is to change the existing codebase so it does not use mouseevents at all, but instead mimics single touch events a'la Apple.
This would mean that tapping a button would generate :
touchstart - generated
(possibly touchmove) - generated
touchend - generated
mousedown - built in
mouseup - built in
click - built in
This would be more consistent I think, but would also require mimicking other parts of the touch API so that frameworks like Sencha / iScroll would use them.
Without deeper access to the underlying browser component, there is not much more I can do on this issue.
> 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
>
> Original Estimate: 9h
> Remaining Estimate: 9h
>
> 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