[TIMOB-7928] MobileWeb: label doesn't support click or singletap event
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-03-13T17:13:48.000+0000 |
Affected Version/s | Release 2.0.0 |
Fix Version/s | Release 2.0.0, Sprint 2012-06 |
Components | MobileWeb |
Labels | qe-port |
Reporter | Tim Poulsen |
Assignee | Bryan Hughes |
Created | 2012-03-08T11:03:55.000+0000 |
Updated | 2012-08-09T14:28:43.000+0000 |
Description
Expected results
Clicking the label should display the alert. Using thesingletap
event should also work.
Actual results
Works in iOS/Android, no alert displayed in Mobile Web. Code works withsingletap
in native also, but not MW.
var label1 = Titanium.UI.createLabel({
color:'#999',
text:'Mobile Web Rocks!',
font:{fontSize:20,fontFamily:'sans-serif'},
textAlign:'center',
width:'auto'
});
label1.addEventListener('click', function() {
alert('label was clicked');
});
win1.add(label1);
Attachments
File | Date | Size |
---|---|---|
app.js | 2012-03-12T14:15:52.000+0000 | 1242 |
This is the expected behavior. The same thing happens on iOS last time I checked. The "touchEnabled" property controls whether or not a control receives touch events, and it defaults to false in labels. Set it to true to receive events.
I stand corrected. It looks like the behavior was changed in iOS and we weren't informed of this change.
OK, that would have surprised me if required. I've never heard of that requirement on iOS or Android and have added touch events to labels quite frequently (demos during training a lot). I can confirm that setting touchEnabled=true works. So it looks like you just have to flip the default.
Pull Request: https://github.com/appcelerator/titanium_mobile/pull/1644
Tested On: Titanium studio : 2.1.1.201207271312 SDK version : 2.2.0.v20120809014911 Android 4.0.4 - default ,chrome 18.0 Iphone 4.3.5 - safari mobile Mountain lion(10.8) - chrome 21.0,safari 6,firefox 14.0.1
Tested On: Titanium studio : 2.1.1.201207271312 SDK version : 2.2.0.v20120809014911 Android 4.0.4 - default ,chrome 18.0 Iphone 4.3.5 - safari mobile Mountain lion(10.8) - chrome 21.0,safari 6,firefox 14.0.1