Opened 3 years ago

Closed 3 years ago

#18848 closed defect (fixed)

dojox/mobile/Switch renders improperly because resize() is not called on startup

Reported by: Martin Minka Owned by: dylan
Priority: undecided Milestone: 1.10.6
Component: Dojox Version: 1.11.1
Keywords: Cc:
Blocked By: Blocking:


fix implemented in ticket #18353 causes that resize() is never called on startup.

this causes that the switch is not correctly rendered

Change History (4)

comment:1 Changed 3 years ago by Martin Minka

Last edited 3 years ago by Martin Minka (previous) (diff)

comment:2 Changed 3 years ago by bill

Note that startup() is really only supposed to call resize() if the widget isn't the child of a layout widget, as per this code in dijit/layout/_LayoutWidget.js:

if(!(parent && parent.isLayoutContainer)){
	// Do recursive sizing and layout of all my descendants
	// (passing in no argument to resize means that it has to glean the size itself)

	// Since my parent isn't a layout container, and my style *may be* width=height=100%
	// or something similar (either set directly or via a CSS class),
	// monitor when viewport size changes so that I can re-layout.
	this.own(Viewport.on("resize", lang.hitch(this, "resize")));

In your case it might not hurt to call resize() unconditionally on startup()... it depends if the resize() code throws an exception if it's run while the Switch is hidden.

comment:3 Changed 3 years ago by Martin Minka

@bill, thank you for comment.

I suggest to create other pull request if there is more improvement needed then my simple regression.

The resize() code was always called before #18353 and it is never called after. Not calling resize() causes wrong rendering of the switch element on page.

Note: See TracTickets for help on using tickets.