Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1131] preventDefault not working in web view

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2011-04-15T02:44:52.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.4.0
ComponentsiOS
Labelsn/a
ReporterNolan Wright
AssigneeBlain Hamon
Created2011-04-15T02:44:52.000+0000
Updated2017-03-02T19:22:02.000+0000

Description

Base UI => Views => Mixing Views

top view is a web with this:

document.body.addEventListener("touchmove", function(e) {e.preventDefault();}, false);

but it still scrolls - this had worked previously

Comments

  1. Stephen Tramer 2011-04-15

    Ran the test against HEAD, Base UI -> Views -> Mixing Views and tried to scroll the web view. With this line in it, it didn't scroll. With the line removed, it did. Seems like preventDefault() works.

  2. Nolan Wright 2011-04-15

    which line are you talking about?

  3. Stephen Tramer 2011-04-15

    The line in question:

    document.body.addEventListener("touchmove", function(e) {e.preventDefault();}, false);

    When the HTML reads:

       var html = '<html><body style=";color:#bbb;font-family:Helvetica Neue;text-align:center;">';
       html += '<div style="font-size:20;font-weight:bold;">I am a web view</div>';
       html += '<div id="foo" style="font-size:14;font-weight:bold;">click me</div>';
       html += '<script>document.getElementById("foo").ontouchstart = function()';
       html += '{Ti.App.fireEvent("webview_click");document.body.addEventListener("touchmove", function(e) {e.preventDefault();}, false);};</script>';
       html += '</body></html>';
       

    (with the event listener present) things work. More accurately, it worked in 3.2 simulator.

    Additional confirmation on this might be good. I'll test on 3.1 and 4.0 device.

  4. Stephen Tramer 2011-04-15

    Confirmed. Doesn't work in 3.1, does work in 3.2 and 4.0. Must be a Safari thing.

  5. Lee Morris 2017-03-02

    Closed as invalid.

JSON Source