Problem
The 'click' event of a view fires when the view is touched, even before the finger (or mouse) is released.
A true 'click' does not (should not) exist until the component receives a mouse-down followed by a mouse-up without the mouse moving in between. The iOS implementation is not adhering to this definition.
Expected behavior
When you touch and hold your finger (or mouse) down on a view, only the touchstart, longpress, and longclick (Android only) events should fire. The click event should not fire until the finger (or mouse) is lifted, and then only if the finger (or mouse) has not moved since the touch started.
Actual behavior
When you touch and hold your finger (or mouse) down on a view on the iPhone simulator, the click event fires.
Works on Android correctly.
Broken on iOS.
Therefore, this is also a parity issue.
Testcase
app.js:
win1=Ti.UI.createWindow({havbarHidden:false,
layout:'vertical',
backgroundColor:'gray'});
vw1=Ti.UI.createView({height:80,
left:30,
right:30,
backgroundColor:'blue'
});
win1.add(vw1);
lbl1=Ti.UI.createLabel({text:'Press and hold the blue box above',
color:'white'});
win1.add(lbl1);
function DoClick()
{
alert('View got clicked');
}
vw1.addEventListener('click',DoClick);
win1.open();
Duplicated by TIMOB-11866, but note that there is a side effect of the fix to TIMOB-11866: if a slow click is performed (where the click lasts longer than half a second), the click event doesn't fire at all. I think the click even should fire in this case unless there is a longpress event assigned to the same view.
Cannot reproduce with 5.5.1.GA and iOS 10 anymore. Demo:
Closing ticket with reference to the above comments.