styanddty / blockly

Automatically exported from code.google.com/p/blockly
0 stars 0 forks source link

Blockly overrides the events of the whole window with touch screens #178

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The code that makes Blockly work with touch screens breaks the expected 
behaviour of the browser, making imposible to integrate Blockly with another 
applications.

What steps will reproduce the problem?
1. Add a simple <button onclick="alert('It works')">CLICK ME</button> in an 
HTML page with Blockly.
2. Comment out the "Blockly.inject" bit and navigate to the HTML in an iPad. 
Taping in the button shows the expected alert.
3. Now uncomment the "Blockly.inject" statement. Blockly works but the test 
button is no longer responding.

What is the expected output? What do you see instead?
I should see an alert pop up. Nothing happens

What browser are you using?
Safari and Chrome on iPad4 with iOS7

Please provide any additional information below.

This preventDefault statement is the  one that kills the expected behaviour.

Original issue reported on code.google.com by escala...@gmail.com on 11 Nov 2013 at 12:03

GoogleCodeExporter commented 8 years ago
https://code.google.com/p/blockly/source/browse/trunk/core/utils.js#105

Original comment by escala...@gmail.com on 11 Nov 2013 at 1:22

GoogleCodeExporter commented 8 years ago
I found that binding the "touchend" event to the event handler solves the 
problem.
In jquery:
function myHandler() {
  alert("click!");
}
$("#my_button").on('click', myHandler).on('touchend', myHandler);

Original comment by roberto....@gmail.com on 27 Feb 2014 at 8:23

GoogleCodeExporter commented 8 years ago
Fixed in r1670.

Original comment by neil.fra...@gmail.com on 28 Mar 2014 at 7:18