View Full Version : On the BlackBerry PlayBook, "landscape" and "portrait" are reversed.

Marc Paradise
26 Mar 2011, 2:53 PM
Sencha Touch version tested:


Platform tested against:

BlackBerry PlayBook simulator 0.9.3
BlackBerry PlayBook simulator 0.9.4


Orientation in the Playbook is reversed from ST's expectations, such that when window.orientation == 0 or 180, it's in landscape mode.

Test Case:
Orientation change event handler; assuming var "x" is a valid Ext.Element:

Ext.getBody().update("window.orientation = " + window.orientation +
" Ext.Viewport.getOrientation() = " + Ext.Viewport.getOrientation());

Debugging already done:

verified through similar debug output code above that the playbook is providing an orientation of 0 for landscape mode. Was not able to confirm 180 as well, b/c the simulator does not provide it.

Possible fix:

Element.getOrientation modified as follows: (note: depends on this change (http://www.sencha.com/forum/showthread.php?128136-Playbook-Sencha-Touch-has-no-support-to-detect-BlackBerry-PlayBook-devices))

if (Ext.supports.OrientationChange) {
if (Ext.is.PlayBook) {
return (window.orientation == 0) ? 'landscape' : 'portrait'; } else {
return (window.orientation == 0) ? 'portrait' : 'landscape';

Viewport.getOrientation modified as follows:

if (window.hasOwnProperty('orientation')) {
if (Ext.is.PlayBook) {
return (window.orientation == 0 || window.orientation == 180) ? 'landscape' : 'portrait';
} else {
return (window.orientation == 0 || window.orientation == 180) ? 'portrait' : 'landscape';


Marc Paradise
8 Apr 2011, 11:13 AM
It also appears that for at least the Xoom tablet running Honeycomb, landscape and portrait are similarly reversed

Is anything further needed to get this accepted as a valid bug?

24 Jun 2011, 7:01 AM
In the case of the Honeycomb tabs, this is actually the desired behaviour. The natural orientation for most of these devices is "landscape" (what we would call "landscape" anyway, i.e short and fat)- since this is the natural orientation, this is treated as "portrait" and this is what get's returned by the get orientation functions.

The galaxy tab and android phones are naturally "portrait" devices and so they return the orientation we would expect.

So basically, in android terms it is simply the natural orientation of the device which is determines "portrait" and "landscape" modes, not the viewport.

This is extremely annoying if you want to develop an app which will run on phones and tabs with orientation dependant behaviour.

As a workaround, i'm thinking of writing a plugin which will return the "real" orientation.

I'll keep you posted

24 Jun 2011, 9:00 AM
Interesting Dean :), thanks for sharing.

24 Aug 2011, 1:07 AM
The Samsung Galaxy Tab 10.1 with Android 3.1 also has the orientation reversed.

Are there any patches for this?

24 Aug 2011, 1:10 AM
Are you building a pure Web App or are you wrapping it in Phonegap to build a semi-native app?

24 Aug 2011, 2:22 AM
Ext.getOrientation() returns the expected result.

24 Aug 2011, 2:23 AM
Are you building a pure Web App or are you wrapping it in Phonegap to build a semi-native app?

A pure web app.