[TIMOB-1131] preventDefault not working in web view
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2011-04-15T02:44:52.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.4.0 |
Components | iOS |
Labels | n/a |
Reporter | Nolan Wright |
Assignee | Blain Hamon |
Created | 2011-04-15T02:44:52.000+0000 |
Updated | 2017-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
- 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.
- Nolan Wright 2011-04-15
which line are you talking about?
- 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.
- 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.
- Lee Morris 2017-03-02 Closed as invalid.