Virtual Keyboard Closing Issue with BlackBerry WebWorks on BlackBerry OS 7

by Retired on ‎07-24-2012 03:20 PM (3,101 Views)

Symptoms

When closing the virtual keyboard in a BlackBerry® WebWorks™ application, the page stays shifted upwards and the underlying area where the keyboard previously appeared presents a white background. The page does not shift downwards to display in its original state after closing the virtual keyboard.

Diagnosis

This is a known issue within BlackBerry® 7.0 and 7.1.

Solution

The workaround is to include the following code in your BlackBerry WebWorks application:

 

Using JavaScript®: 

window.addEventListener("resize", 
   function(e) {
     window.scrollTo(0,0); 
   }, false);

Using jQuery™: 

$(window).resize(function(){
    $(window).scrollTop(0);
});

The function will occur whenever the window is resized, and in this case, when the virtual keyboard is closed.