Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-10734

iOS: Parity with Android Webview event handling

    Details

      Description

      Event handling for a webview does not match Android.

      Test Case Number 1:

      var window = Titanium.UI.createWindow();
       
      window.addEventListener('click', function(e) {
              alert('window click');
      })
       
       
      var webView = Titanium.UI.createWebView();
      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 click');
      //})
      window.add(webView);
      window.open();
      

      Expected result: Click on "Click me" brings up 123456 alert.
      Click on background brings up "window click" alert.

      Actual result: Click on "Click me" works as expected.
      Click on background has no effect.

      Test Case Number 2:

      var window = Titanium.UI.createWindow();
       
      window.addEventListener('click', function(e) {
              alert('window click');
      })
       
       
      var webView = Titanium.UI.createWebView();
      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 click');
      })
      window.add(webView);
      window.open();
      

      Expected result: Clicking on "click me" brings up 3 alerts, one for
      the link, one for the webview, and one for the window.

      Clicking on the background brings up 2 alerts – one
      for the webview and one for the window.

      Actual result: Clicking anywhere brings up two alerts – one for the webview
      and one for the window. Clicking on the "Click me" link has
      the same effect, and the "123456" alert is never displayed.

      Test Case Number 3:

      var window = Titanium.UI.createWindow();
       
      //window.addEventListener('click', function(e) {
       //       alert('window click');
      //})
       
       
      var webView = Titanium.UI.createWebView();
      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 click');
      })
      window.add(webView);
      window.open();
      

      Expected result: Clicking on "Click me" brings up "123456" alert and also "webview clicked" alert.
      Clicking on background brings up "webview clicked" alert.

      Actual result: Clicking anywhere brings up "webview clicked" alert only.
      Clicking on "click me" link does not bring up "123456" dialog.

        Attachments

          Activity

            People

            • Assignee:
              ingo Ingo Muschenetz
              Reporter:
              krowley Karl Rowley
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-14129
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration