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

Reply
Contributor
RoyWinnie
Posts: 31
Registered: ‎05-09-2011
My Device: OS6
My Carrier: AT&T

Navigation key Issue on Latest blackberry OS6. Is it a known platform issue?

Hi All,

 

We meeting an performance issue of navigation key on 9300 (upgrade to OS6) and 9800, when we try to create HTML element dynamic. 

We are try to create some element, code as below, and after element display at UI, We try to operate navigation key, but there is no response. About 15s later, all my operation of navigation key will be execute at once. Seems BB system cached my operation, since it can not handle it. Is it a known issue on this platfrom? Because we also test it on 9700 (os5), it works better than OS6.

 

function create(){
    flag_time = new Date().getTime();
    var num = parseInt(document.getElementById("numberTxt").value);
    var itemListContainer = document.getElementById("itemListDiv");
    itemListContainer.innerHTML = "";
    for(var i = 1 ; i <= num ; i++){
        var tempDiv = document.createElement("div");
        tempDiv.innerHTML = "ITEM "+ (i < 10 ? "00"+i : i<100 ? "0"+i : i)+" ";
        tempDiv.setAttribute("x-blackberry-focusable", "true");
        tempDiv.addEventListener("click", function(){},
                false);
        itemListContainer.appendChild(tempDiv);
    }
    document.getElementById("messageDiv").innerHTML = "Run time is " + (new Date().getTime()-flag_time);
}

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Navigation key Issue on Latest blackberry OS6. Is it a known platform issue?

OS6 does have some performance issues when it comes to the focus based navigation mode.  We have identified the issue, we are looking for a spot to slot it into the schedule.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Contributor
RoyWinnie
Posts: 31
Registered: ‎05-09-2011
My Device: OS6
My Carrier: AT&T

Re: Navigation key Issue on Latest blackberry OS6. Is it a known platform issue?

Thanks for reply.

Please use plain text.
Contributor
drjg22
Posts: 47
Registered: ‎03-27-2010
My Device: Bold 9000
My Carrier: Rogers

Re: Navigation key Issue on Latest blackberry OS6. Is it a known platform issue?

[ Edited ]

Hi Tim,

 

I too am experiencing a similar issue as the OP in OS6.

 

I dynamically create rows of data (25 - 30) by first removing the existing the div and then appending a new one with the resultset, making sure to utilize the setTimeout() method to add future rows (this prevents the 'exception error' that crashes the app). But what I find is, after the rows of data have been generated and displayed, the cursor is not responsive for a while. It's only after a good 15 - 25 seconds does the cursor become active again and begins to follow the path that I was attempting to do while in the frozen state. It's almost as if it's playing catch up.

 

Would this be the related to issue(s) you have identified? Do you know a workaround to prevent this from happening? I have received emails from people who have downloaded my app and it seems to be a common issue with most of them.

 

Thanks for your help as always.

 

 

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Navigation key Issue on Latest blackberry OS6. Is it a known platform issue?

by "cursor" do you mean the "mouse pointer" or are you referring to the cursor as the highlighted dom element used in the focus navigation?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Contributor
drjg22
Posts: 47
Registered: ‎03-27-2010
My Device: Bold 9000
My Carrier: Rogers

Re: Navigation key Issue on Latest blackberry OS6. Is it a known platform issue?

It would be the highlighted dom element used in the focus navigation.

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Navigation key Issue on Latest blackberry OS6. Is it a known platform issue?

You are probably experiencing the same slow down as mentioned.  Every time the DOM is manipulated the Focus based navigation needs to re-index all of the DOM elements to get their bounding rects.  Currently on 6.0 this takes a long time.

 

To minimize the effect you are seeing.. I would suggest using a document fragment or disconnect the element from the live DOM before manipulating it and then re-insert the DOM element. You will see tremendous speed increases by doing it this way vs 25-30 different DOM manipulations

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Contributor
drjg22
Posts: 47
Registered: ‎03-27-2010
My Device: Bold 9000
My Carrier: Rogers

Re: Navigation key Issue on Latest blackberry OS6. Is it a known platform issue?

When you say 'disconnect', do you mean remove  the element? Because the my  current method is removing the existing table, dynamically creating the 25 rows (with the a focusable DOM element in each) and then appending it as a new table. Isn't this similar to your suggestion? My appologies, I'm a little confused.

 

 

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Navigation key Issue on Latest blackberry OS6. Is it a known platform issue?

Yes when I say "disconnect" I mean remove the dom element from the document using a removeChild() call.  Then manipulate the element and then insert it back in with an appendChild() call or something along those lines.

 

If this is what you are doing, then you are doing the best practice.

 

For each DOM element you have in your page that is marked as a focusable element... each time the focus tree is mapped it must make at least 5 synchronous IPC calls to WebKit from Java to determine the bounding rects for the element.    So 25 focusable elements means 125 synchronous round trip IPC calls to WebKit on BB6.

 

On BB5 everything was in Java and there wasn't an IPC channel in the middle.

 

Where we are heading with the focus based navigation is to push all of the focus tree calculation logic around bounding rectangles into JavaScript itself. This removes the IPC calls needed and greatly speeds up the indexing.

 

Go figure.. JavaScript runs faster than Java accessing the DOM :smileyhappy:

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Contributor
drjg22
Posts: 47
Registered: ‎03-27-2010
My Device: Bold 9000
My Carrier: Rogers

Re: Navigation key Issue on Latest blackberry OS6. Is it a known platform issue?

[ Edited ]

Thanks for that information - now I have a better understanding of what's really going on behind the scenes. Unfortunately, it would seem then that there really isn't a viable workaround because it would appear I am following the best practice as you mentioned.

But that being said, it would seem that you guys have identified a solution with removing the IPC calls so can we expect the next (or future) release to include this? :smileyhappy: 

Please use plain text.