Opened 7 years ago

Last modified 23 months ago

#15910 assigned defect

dojox/mobile/common should be required by dojox/mobile/Opener and dojox/mobile/SearchBox

Reported by: Adrian Vasiliu Owned by: Patrick Ruzand
Priority: undecided Milestone: 1.14
Component: DojoX Mobile Version: 1.8.0
Keywords: Cc:
Blocked By: Blocking:


A number of modules behave correctly only if dojox/mobile/common has been previously loaded. In most cases, "common" is guaranteed to be loaded before the module which needs it. But there are a few exceptions, where the module does not require "common" directly nor indirectly. Thus, in such cases these modules misbehave due to dojox/mobile/common not being loaded, or being loaded too late. These situations tend to become more frequent with the new auto-require mechanism starting with Dojo 1.8, but it would be the same if the modules used in markup would be required explicitly in the same order as their declarative usage in markup.

The two dojox/mobile modules which need dojox/mobile/common while not ensuring it is loaded (do not require "common" directly nor indirectly):

a) dojox/mobile/Opener uses the CSS class "dj_phone" which is conditionally added to doc.documentElement by dojox/mobile/common.

b) dojox/mobile/SearchBox uses the CSS class "dj_chrome" (via SearchBox?.css), which is conditionally added to doc.documentElement by dojox/mobile/common.

How to reproduce:

  1. Load the attached test_Missing_Common.html for instance in Chrome 21 on desktop (ensure the smallest window dimmension is larger than 500 px, since this case should trigger the addition of dj_tablet).
  2. The test displays a text saying whether the CSS classes dj_phone, dj_table, and dj_chrome are present. It displays the values as detected on dojo/ready, and the values after explicitly requiring dojox/mobile/common. You can see the two are different, the values being correct only after requiring dojox/mobile/common.


  • dojox/mobile/common is most often loaded before other dojox/mobile modules, because most apps require the dojox/mobile module (which requires it indirectly) and/or modules such as dojox/mobile/View and dojox/mobile/_base (which require dojox/mobile/common). This is why this bug hurts only rarely.
  • dojox/mobile/common also provides the "hide address bar" feature, which obviously can't work without this module being required directly or indirectly. Now, since this feature is activated via a data-dojo-config option, we cannot ensure the module is required simply by adding a dependency to some existing module. Here, the best we can do is to improve the documentation (but currently there isn't much documentation about it).
  • SearchBox is new in Dojo 1.8, so backporting the fix into 1.7.x is pointless. But Opener is already present in 1.7.x, so backporting the fix for it may be welcome.

Attachments (2)

test_Missing_Common.html (2.1 KB) - added by Adrian Vasiliu 7 years ago.
Test case to reproduce this bug.
patch15910.patch (1.3 KB) - added by Adrian Vasiliu 7 years ago.
Add missing dependency on dojox/mobile/common - Adrian Vasiliu, IBM, CCLA

Download all attachments as: .zip

Change History (9)

Changed 7 years ago by Adrian Vasiliu

Attachment: test_Missing_Common.html added

Test case to reproduce this bug.

Changed 7 years ago by Adrian Vasiliu

Attachment: patch15910.patch added

Add missing dependency on dojox/mobile/common - Adrian Vasiliu, IBM, CCLA

comment:1 Changed 7 years ago by Adrian Vasiliu

For completeness, here's the (obvious) workaround for an app that would hit this bug: just require "dojox/mobile/common" yourself.

comment:2 Changed 7 years ago by ykami

Good point. Adding a new dependency on common may be a simple and workable solution, but the reason why many dojox/mobile widgets do not have explicit dependency on common is to allow the users to use them for any type of applications including desktop applications. I think Opener can have its own simple logic to determine if the current environment looks like phone or not. The logic may be used only when both "dj_phone" and "dj_tablet" do not exist.

As for SearchBox, it should require dojo/uacss, not common.

comment:3 Changed 6 years ago by Patrick Ruzand

Owner: changed from Eric Durocher to Patrick Ruzand
Status: newassigned

comment:4 Changed 4 years ago by dylan

Milestone: tbd1.11

Land the patch or close the ticket (note the patch has a typo in its change to the AMD dependency list). Please decide and update the ticket!

comment:5 Changed 4 years ago by dylan

Milestone: 1.111.12

Ok, after massive triage, ended up with about 80 tickets for 1.11 and 400 or so for 1.12. That's a bit unrealistic, so first I changed all 1.12 to 1.13 (with the plan to move some forward to the new 1.12. Now, I'm moving some of the 1.11 tickets that are less likely to get done this month without help to 1.11. Feel free to help out in January if you want to see this ticket land in 1.11.

comment:6 Changed 3 years ago by dylan

Milestone: 1.121.13

Ticket planning... move current 1.12 tickets out to 1.13 that likely won't get fixed in 1.12.

comment:7 Changed 23 months ago by dylan

Milestone: 1.131.14
Note: See TracTickets for help on using tickets.