[TIMOB-18744] touchEnabled not true by default
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-06-02T07:35:29.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.4.0 |
Components | TiAPI |
Labels | TCSupportTriage, button, label, qe-5.4.0, touchEnabled, view |
Reporter | Andrey Tkachenko |
Assignee | Ashraf Abu |
Created | 2015-02-10T15:28:12.000+0000 |
Updated | 2016-07-25T22:50:18.000+0000 |
Description
[Documentation says](http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.View-property-touchEnabled) that default value of touchEnabled must be true. This is untrue.
<Alloy>
<Window layout="vertical" backgroundColor="#ffffff" color="#000000" >
<Button onClick="doClick">I'm button, click me</Button>
<Label onClick="doClick">I'm label, click me</Label>
<View onClick="doClick" height="Ti.UI.SIZE"><Label>I'm view, click me</Label></View>
</Window>
</Alloy>
function doClick(e) {
alert('touchEnabled = '+typeof(e.source.touchEnabled));
}
$.index.open();
PR: https://github.com/appcelerator/titanium_mobile/pull/8000 Test case 1: https://gist.github.com/hansemannn/6d2c919c7e584130dd1dea37b68da38f Test case 2: https://gist.github.com/hansemannn/19557b8852be1b36a646b7c45cebf2b1
[~hansknoechel] and Android? does [~msamah] need to do something here? I maybe thinking too much into it but, there's no 'breaking' behavior or user experience change we need to be aware of?
The only change is, that the proxy sets the default value inside the TiUIView. It's more an improvement than a bugfix. The docs could also say "default: undefined (acts as true)", but this solution makes the API a bit cleaner. I can check for Android, but as earlier comments state its happening on both platforms, we may need to pre-set it there as well. EDIT: Tested with Android, it's undefined. So we need to update it on Android as well. [~msamah]?
[~hansknoechel] I'm a bit skeptical of the usage of userInteractionEnabled property. According to this : https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/#//apple_ref/occ/instp/UIView/userInteractionEnabled It includes KEYBOARD as well. I'm not sure if there are cases where developers requires views that is touch disabled, but still keyboard enabled :/ by the way, good catch on the IFDEF AUTOLAYOUT for TiUIView. we should include that fix no matter what.
PR Merged. (PR was fixed to just set property to true but default.) [~msamah] can you do a PR for this too please?
Changes assignee to Ash for the Android-part.
PR: https://github.com/appcelerator/titanium_mobile/pull/8033 [~hpham] for your review.
PR merged.
Verified as fixed, with both Android & iOS platforms,
touchEnabled
property is true by default. Tested On: iPhone 6S (9.3.2) Device Nexus 6P (6.0.1) Device Mac OSX El Capitan 10.11.5 Ti SDK: 5.4.0.v20160725003348 Appc Studio: 4.7.0.201607111053 Appc NPM: 4.2.7 App CLI: 5.4.0-34 Xcode 7.3 Node v4.4.7 *Closing ticket.*