[TIMOB-14849] iOS: JavaScript click event is not registered when parent webview's click event is also handled
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-08-13T17:35:04.000+0000 |
Affected Version/s | Release 3.1.2 |
Fix Version/s | 2013 Sprint 17, 2013 Sprint 17 API |
Components | iOS |
Labels | qe-3.1.2 |
Reporter | Anshu Mittal |
Assignee | Ingo Muschenetz |
Created | 2013-08-13T10:32:19.000+0000 |
Updated | 2017-03-03T22:04:33.000+0000 |
Description
Javascript click event is not registered when parent webview's click event is also handled. This is not regression since the issue occurs on 3.1.1 GA as well.
Steps to reproduce:
1. Create an app using the code below.
2. Launch the app.
3. Click on 'click me' label.
Expected:
Alert should appear on screen with message "123456"
Actual:
No alert appears with the above message.
var _window = Titanium.UI.createWindow({
backgroundColor:'#fff'
});
_window.backgroundColor = 'yellow'
_window.addEventListener('click', function(e) {
alert('Window clicked');
});
var webView = Titanium.UI.createWebView({
top : 30
});
var html = '<html>' + '<body>' + '<br />' + '<br />' + '<br />' + '<br />' + '<br />' + '<br />' + '<a onclick="javascript:alert(123456)">Click me!</a>' + '</body>' + '</html>';
webView.html = html;
webView.addEventListener('click', function(e) {
alert('WebView Clicked');
});
_window.add(webView);
_window.open();
Webview has a property [webview.willHandleTouches](http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.WebView-property-willHandleTouches) do with this exact issue. On iOS we can choose to either handle all the events inside the html itself or have the webview and its parent have and not both at the same time. By setting this property to false, the alert 123456 will be fired properly. Refer documentation for more infromation. Test with following code same to get the correct behavior.
Marking ticket as invalid.
Closing as invalid.