Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12989] Android: Events still fire if touchEnabled on view is false

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.0.2
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterLeor Brenman
AssigneeJoshua Quick
Created2013-03-07T00:45:16.000+0000
Updated2021-02-22T18:37:15.000+0000

Description

Desription

touchEnabled on view not working on Android. If touchEnabled property is set to false for any view it still fires the click event on that view. An app contain 3 views namely View1->View2->View3 (Parent->Child) and have registered the click event listeners for all views. Ideally when touchEnabled property is set to false for View1 (parent most) then no click event listener should fire for any view. Same is working fine for iOS. But in android it fires all the event even if touch enabled property is set to false for View1(most parent).

Test Case

var win = Titanium.UI.createWindow({  
    title:'Testing Touch Enabled',
    backgroundColor:'#fff'
});
 
var view1=Titanium.UI.createView({
    touchEnabled:false,
    borderRadius:10,
        backgroundColor:'red',
        width:50,
        height:50
});
var view2=Titanium.UI.createView({
    //touchEnabled:false,
    backgroundColor:'yellow',
});
var view3=Titanium.UI.createView({
    //touchEnabled:false
});
 
view2.add(view3);
view1.add(view2);
win.add(view1);
 
 
 
view1.addEventListener('click', function(){
    Titanium.API.info('VIEW 1');
    alert('VIEW1');
});
 
view2.addEventListener('click', function(){
    Titanium.API.info('VIEW 2');
    alert('VIEW2');
});
 
view3.addEventListener('click', function(){
    Titanium.API.info('VIEW 3');
    alert('VIEW3');
});
 
win.open();

Steps to Reproduce

1. Create a project using above code 2. Run the application in android (device/simulator) 3. click on view

Expected Behaviour

Click event should not fire and logs should not get printed on console as specified in eventListener.

Actual Behaviour

Click event gets fired and logs get printed : VIEW1 VIEW2 VIEW3

Attachments

FileDateSize
test.zip2013-03-07T00:45:16.000+00003695967

Comments

  1. Matthew Congrove 2014-03-04

    Having this same issue; anyone using a sliding menu paradigm will run into this problem as well. The work-around is to have a transparent view that sits on top of the main content view and show it when the menu opens to disable any clicks, but this often presents other problems in itself.
  2. Matthew Congrove 2014-06-03

    Any movement on this?
  3. f 2014-07-01

    I can confirm the issue. I have run test case against SDK 3.2.1 and Android Emulator 4.2.2 This badly breaks UI design, please fix it!
  4. Alexey Chulochnikov 2014-08-14

    Please fix it!
  5. Ingo Muschenetz 2014-08-14

    I believe this is the same issue as TIMOB-16637? Is that correct?
  6. Silambarasan Raman 2015-06-10

    Hi All, I am also getting this issue, Is there any improvement? Awaiting for your response
  7. Gertjan Smits 2017-06-12

    4 years later, we're still seeing this behaviour :)
  8. Guillermo Figueras 2018-01-23

    No news on this? It's still happening on SDK 6.3.0.GA & 7.X.X
  9. Brian García 2019-05-15

    still happening in 8.0.0.GA

JSON Source