Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#18353 closed defect (fixed)

dojox/mobile/Switch renders improperly if theme not loaded by startup call

Reported by: Nick Nisi Owned by: Patrick Ruzand
Priority: high Milestone: 1.11
Component: DojoX Mobile Version: 1.10.2
Keywords: Cc:
Blocked By: Blocking:

Description

Since 1.10, dojox/mobile/Switch calls resize inside the startup method. A problem occurs if dojox/mobile/deviceTheme has not finished loading the appropriate CSS when resize is called. resize gets the width of the widget, which is 0 until the CSS is loaded, so the widget does not render properly

Example: http://jsfiddle.net/nicknisi/w73ctm0o/

Additionally, the startup method checks the truthiness of this._started, but never calls this.inherited(arguments) so _started will never be truthy.

Change History (7)

comment:1 Changed 5 years ago by dylan

Milestone: tbd1.11
Owner: set to Patrick Ruzand
Priority: undecidedhigh
Status: newassigned

comment:2 Changed 4 years ago by Patrick Ruzand

A problem occurs if dojox/mobile/deviceTheme has not finished loading the appropriate CSS when resize is called.

Based on the fiddle you linked to the issue, I understand that you load deviceTheme via a require() call. If so, this is not a valid way to load it. As stated in the documentation, "Using the script tag as above [ie via a <script> tag] is the recommended way to load the deviceTheme. Trying to load it using the AMD loader can lead to styles being applied too late, because the loading of the theme files would be performed asynchronously by the browser, so you could not assume that the loading has been completed when your widgets are initialized."

The missing this.inherited call is a real bug indeed.

comment:3 Changed 4 years ago by dylan

This is the first time we've run into this type of timing issue with deviceTheme (1.10, with the switches), and we pretty much always include it as an AMD dependency.

That said, rather than encouraging a separate script tag, wouldn't it be better to at least encourage a nested require statement with deviceTheme first, and then the various mobile widgets?

comment:4 Changed 4 years ago by Patrick Ruzand

I don't see why it would be "better" (except for the build aspect), but indeed, at least for the sake of completeness the documentation could also mention the nested require approach. I will update the documentation. Thx.

comment:6 Changed 4 years ago by Patrick Ruzand <pruzand@…>

Resolution: fixed
Status: assignedclosed

In 8bde71900acdc3d987f3dd5557b1beaa7de8c055/dojox:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:7 Changed 4 years ago by Patrick Ruzand <pruzand@…>

In 58ce422e0b0cd2f6e6a5fccbf8ab7ce68df5b1aa/dojox:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 
Note: See TracTickets for help on using tickets.