Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16898] iOS: ListView: cancelBubble = true on swipe does not prevent itemclick event from firing

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.2.2
Fix Version/sn/a
ComponentsiOS
LabelscancelBubble, event, ios, itemclick, listview, swipe
ReporterEd
AssigneeUnknown
Created2014-04-23T12:31:10.000+0000
Updated2018-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();

Comments

  1. Ritu Agrawal 2014-04-30

    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.
  2. Shameer Jan 2014-08-27

    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
  3. Yiran Mao 2014-10-20

    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.

JSON Source