Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 67
Registered: ‎06-28-2012
My Device: BlackBerry Z10LE
My Carrier: T-Mobile
Accepted Solution

Are the touch events in new Ripple broken ?

Hi,

 

I have a PlayBook application that uses touch events for moving stuff around. I've been testing it in the standalone version of Ripple and on the physical device.

Now I'm thinking about porting the app to BB10, so I downloaded the Chrome verion of Ripple and I found that in the new Ripple I can't move any object!

 

I've identified the problem but I don't know how to deal with it. Here is a small HTML file that shows the problem:

 

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
    <div id="container" style="background-color: Green; width: 500px; height: 500px">
        <div id="child" style="position: absolute; left: 100px; top: 100px; background-color: Red; width:50px; height: 50px">child</div>
    </div>
    <script type="text/javascript">
        function onTouchStart(e) {
            alert("touch start");
        }

        var container = document.getElementById("container");
        container.ontouchstart = onTouchStart;
    </script>
</body>
</html>

So basically there is a container div that listenes to touchstart event and if it happens it shows an alert. In the old Ripple (and on the PlayBook device) if you press on the "child" div the alert is also shown (the event is pushed down and intercepted by the container). In the new Ripple it doesn't happen.

 

Any suggestions? Can I force Ripple to act as the Playbook does? Or maybe I should use some other technique for catching touch events?

Retired
Posts: 165
Registered: ‎09-24-2012
My Device: Passport
My Carrier: Bell

Re: Are the touch events in new Ripple broken ?

Hi razorek,

 

I am not sure about the reason (its WebKit behaviour), but using AddEventListener will allow for event propagation when using touchstart. Take a look:

 

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
    <div id="container" style="background-color: Green; width: 500px; height: 500px">
    	
    	
        <div id="child" style="position: absolute; left: 100px; top: 100px; background-color: Red; width:50px; height: 50px">child</div>
   
   
    </div>
    <script type="text/javascript">
        function handleTouchStart(e) {
            alert("touch start");
        }

        var container = document.getElementById("container");
        
        container.addEventListener('touchstart',handleTouchStart);
    </script>
</body>
</html>

 Also, when using Ripple for Chrome, please make sure that  "Emulate touch events" is not checked, as Ripple has it's own touch emulation system and it may clash with it.

 

F12 (Open Developer Tools) > Click the gears icon in the bottom right corner > Overrides tab > Emulate Touch Events. I will also post this workaround in the github page for this issue https://github.com/blackberry/Ripple-UI/issues/344

 

Developer
Posts: 67
Registered: ‎06-28-2012
My Device: BlackBerry Z10LE
My Carrier: T-Mobile

Re: Are the touch events in new Ripple broken ?

Thank you anzor_b, works like a charm Smiley Happy!