Opened 6 years ago

Closed 5 years ago

#17786 closed defect (worksforme)

Calling dojox/mobile/Opener (dojox/mobile/Tooltip) show method on an input element causes Reference Error in dijit/ViewPort in iOS

Reported by: evgenyca Owned by: Patrick Ruzand
Priority: undecided Milestone: tbd
Component: DojoX Mobile Version: 1.9.3
Keywords: Cc:
Blocked By: Blocking:

Description

I've instantiated a dojox/mobile/Opener widget that is binded to an <input> element, that is when I click on <input> element I call dojo.on(<input>Dom, "click", myOpener.show(<input>Dom.id));

That works fine on Android, opener(tooltip) shows under <input> element, but when I try to run it on iOS I get the following error in a console Uncaught ReferenceError?: orientation is not defined and after doing a bit or digging I found that this error comes from dijit/Viewport:

Code that causes this error:

  // Account for iOS virtual keyboard, if it's being shown.  Unfortunately no direct way to check or measure.
                var tag = focusedNode && focusedNode.tagName && focusedNode.tagName.toLowerCase();
                if(has("ios") && focusedNode && !focusedNode.readOnly && (tag == "textarea" || (tag == "input" &&
                        /^(color|email|number|password|search|tel|text|url)$/.test(focusedNode.type)))){

                        // Box represents the size of the viewport.  Some of the viewport is likely covered by the keyboard.
                        // Estimate height of visible viewport assuming viewport goes to bottom of screen, but is covered by keyboard.
                        box.h *= (orientation == 0 || orientation == 180 ? 0.66 : 0.40);

as you can see I have an <input> element and iOS simulator, and orientation is expected as a global variable but it is not set.

Was I supposed to do that or was orientation supposed to be set from other place? I'm going to set global variable orientation to a appropriate value for now.

Change History (3)

comment:1 Changed 6 years ago by bill

Component: GeneralDojoX Mobile
Owner: set to Patrick Ruzand

comment:2 Changed 5 years ago by Adrian Vasiliu

orientation is expected as a global variable but it is not set. Was I supposed to do that or was orientation supposed to be set from other place?

No, you are not supposed to set the global variable orientation, iOS sets it. See for instance https://developer.apple.com/library/IOS/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW16

As far as I know, this holds for all iOS versions supported by dojox/mobile (both real devices and simulators), that is iOS 5.x, 6.x and 7.x. What is your iOS version? And, if it is iOS >= 5, could you attach a test case allowing to reproduce?

On my side, by modifying dojox/mobile/tests/test_Tooltip.html - removing input's readonly attribute such that dijit/Viewport's piece of code using orientation gets executed, I do not reproduce with any of the supported iOS versions.

comment:3 Changed 5 years ago by Adrian Vasiliu

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.