[TIMOB-27254] [iOS] WebView click event is not being fired
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 8.0.2, Release 8.1.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Samir Mohammed |
Assignee | Unknown |
Created | 2019-07-18T13:11:22.000+0000 |
Updated | 2019-07-18T19:16:48.000+0000 |
Description
Webview click event is not being fired when the parent window also has a click event. (Works fine on Android).
*app.js*
var window = Ti.UI.createWindow();
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)"> <font size="30" color="red">This is some text!</font></a>' + '</body>' + '</html>';
webView.html = html;
webView.addEventListener('click', function(e) {
alert('WebView Clicked');
});
window.add(webView);
window.open();
*Test steps*
[~smohammed] 1. In iOS implementation is in such a way that you can show only one alert at a time. So it is showing only one alert. I have modified your test case, replaced alert with log message. Now I can see the log for window click event and WebView click event. 2. As for as event of javascript is concerned, it is limitation in iOS. If you want javascript event get fired, you have to use [willHandleTouches](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.WebView-property-willHandleTouches). See following note in doc for detail-