[TIMOB-8038] MobileWeb: View - Touch events of a child view are being reported as touches for the parent
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-03-19T22:29:12.000+0000 |
Affected Version/s | Release 2.0.0 |
Fix Version/s | Release 2.0.0, Sprint 2012-06 |
Components | MobileWeb |
Labels | qe-mw020912, qe-port |
Reporter | Michael Pettiford |
Assignee | Bryan Hughes |
Created | 2012-03-15T12:55:27.000+0000 |
Updated | 2012-08-15T16:03:31.000+0000 |
Description
Steps to reproduce
1. Create a default mobile web app and change the app.js code to the following
var _window = Titanium.UI.createWindow({
title : 'test',
backgroundColor : 'white'
});
function parentEventHandler(e) {
alert('parent received ' + e.type.toUpperCase() + ' event. Source: ' + e.source.id);
}
var sampleParentView = Ti.UI.createView({
bottom : 0,
width : 100,
height : 100,
backgroundColor : 'yellow',
id : 'parent'
});
var sampleChildView = Ti.UI.createView({
width : 50,
height : 50,
backgroundColor : 'red',
id : 'child'
});
sampleParentView.addEventListener('touchstart', parentEventHandler);
sampleParentView.add(sampleChildView);
_window.add(sampleParentView);
_window.open();
2. Run app
3. Touch the red square
Actual result:
The alert is displayed with "parent received TOUCHSTART event. Source parent"
Expected result:
The alert is displayed with "parent received TOUCHSTART event. Source child"
*Note the linked ticket"
FYI the linked ticket was not related. We listen to touch events on all nodes, whether or not an event listener is attached.
Pull Request: https://github.com/appcelerator/titanium_mobile/pull/1745
Updated Pull Request: https://github.com/appcelerator/titanium_mobile/pull/1758
Verified fix on: Titanium studio : 2.1.1.201207271312 SDK version : 2.2.0.v20120814134112 Android 4.0.4 - default ,chrome 18.0 , firefox 14.0.1 Iphone 5.1.1 - safari mobile Mountain lion(10.8) - chrome 21.0,safari 6,firefox 14.0.1