[TIMOB-16898] iOS: ListView: cancelBubble = true on swipe does not prevent itemclick event from firing
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 3.2.2 |
Fix Version/s | n/a |
Components | iOS |
Labels | cancelBubble, event, ios, itemclick, listview, swipe |
Reporter | Ed |
Assignee | Unknown |
Created | 2014-04-23T12:31:10.000+0000 |
Updated | 2018-02-28T20:03:33.000+0000 |
Description
On a ListView with a 'swipe' event, when cancelBubble is enabled on the 'swipe' event, it does not prevent the sequential 'itemclick' event from firing.
This issue is also documented on the following Q/A (second answer): http://developer.appcelerator.com/question/152014
Test:
Load the sample code and swipe left or right on a row item. Both swipe and itemclick events are logged on the console.
Expected result:
Since the swipe event sets cancelBubble = true, the itemclick event should not be fired, and the row item should not be selected.
Use case:
A swipe event that does not trigger an itemclick can be required on some cases, like swiping a slide menu (listview) to hide it from the screen without having one of its items register a click.
app.js
var rows = [];
for (var i = 0; i < 10; i++) {
rows.push({ properties: { title: 'Row '+ i }});
}
var win = Ti.UI.createWindow({
title: 'TEST',
backgroundColor: '#ffffff',
navBarHidden: false
});
var nav = Ti.UI.iOS.createNavigationWindow({ window: win });
var ls = Ti.UI.createListSection({
items: rows
});
var lv = Ti.UI.createListView({
sections: [ls]
});
lv.addEventListener('itemclick', function(e) {
Ti.API.info('itemclick fired!');
});
lv.addEventListener('swipe', function(e) {
e.cancelBubble = true;
Ti.API.info('swipe fired!');
});
win.add(lv);
nav.open();
Moving this ticket to engineering as I can reproduce this issue with the provided test case. This issue was also actively discussed on Q&A thread as noted in the ticket.
Issue still exists with SDK Version 3.2.2 and 3.4.0 Titanium Command-Line Interface, CLI version 3.3.0, Titanium SDK version 3.2.2.GA Titanium SDK version 3.4.0.GA Appcelerator Studio, build: 3.3.0.201407111535 iOS SDK: 7.1 iOS iPhone Simulator: 7.1
Hi Ingo, Still see this happened in SDK 3.4.0GA. And it is not only limited to swipe but also event like click within listItem element.... Titanium Studio, build: 3.4.0.201409261227 iOS SDK: 8.0 iOS iPhone Simulator: 8.0 Is there any possible way to prevent this from happening? It basically make customized listItem useless and I cannot get why this issue is assigned just low priority.