blackberry/BB10-WebWorks-Framework

OS 10.1 - WebWorks reports screen size 571 x 343 (instead of 1280 x 768)

Opened this issue · 4 comments

Observed on dev alpha b, os 10.1.0.1485

WebWorks reports incorrect screen size (screen.width and screen.height) - 571 x 343 or 343 x 571 (depending on device orientation).

This causes various frameworks (including bbui) to fail to detect device model and set correct styles / font size.

Note that window.innerWidth / window.innerHeight are also unreliable, since they report bad values on startup during device rotate (see #661)

I guess this is some sort of "downwards compatibility" for lower resolution mobile sites because I encountered a similar behaviour when using the browser.

I made a responsive design with 3 different media queries. One for devices smaller than 320px, one for devices smaller than 600px and the last one for the devices that are smaller than 960px. For a normal website not a WebWorks Application.

The Z10 with a width of 768px uses the media query for the devices with 320px width and I couldnt get it to change this behaviour with any kind of meta tag.

ejzn commented

Have you tried adjusting the viewport? Seems like things are off? Ie: 768/320 = 2.4 our device pixel ratio.

ejzn - thanks for the note.

I did a quick test and found that screen size is still incorrect after the following code is executed:

var meta = document.createElement('meta');
meta.setAttribute('name','viewport');
meta.setAttribute('content','initial-scale='+ (1/window.devicePixelRatio) +',user-scalable=no');
document.head.appendChild(meta);

window.innerWidth / window.innerHeight are also unreliable if device is rotated during app startup (see #661 ).
The only solution that we have found is to detect this specific scenario and hardcode the correct screen size.

We are still looking for other suggestions.