Opened 8 years ago

Closed 8 years ago

#17470 closed enhancement (wontfix)

Have dijit layout method fire after CSS transitions

Reported by: Wouter Hager Owned by: Wouter Hager
Priority: undecided Milestone: tbd
Component: Dijit Version: 1.9.1
Keywords: Cc:
Blocked By: Blocking:


It might be rather obtrusive, but when the layout/resize method on dijits fires, it doesn't take in account any CSS transitions that may still be in progress. Instead of hacking together listeners for each widget, it may be convenient to have _WidgetBase check for CSS transitions attached to its DOM and handle the layout method accordingly.

Change History (9)

comment:1 Changed 8 years ago by bill

Owner: set to Wouter Hager
Status: newpending

Dijit doesn't have any transition effects on its layout widgets. Can you attach a test case of what you mean?

comment:2 Changed 8 years ago by Wouter Hager

Status: pendingnew

Say the widget gets a transition effect that will adjust its width and height over the course of a second. Any children of the widget will get resized immediately, not when the scaling is done. Layout gets out of sync.

I'm not suggesting dijit has any relation to CSS transitions, but in the specific case of a timed resize event, the layout mixin could take this into account, just as it does border and padding.

comment:3 Changed 8 years ago by bill

Status: newpending

OK, but I still need you to attach a test case.

comment:4 Changed 8 years ago by Wouter Hager

Status: pendingnew

It turns out the problem is a bit more complicated. Since layout widgets depend on JS to calculate their children's new positions, it would be best to calculate the new size ahead of transitions, instead of when transitions end.

However, new positions and dimensions are currently calculated from the parent DOM node only. The parent's new dimensions aren't handed down to layoutChildren. So when the transition starts, the children are repositioned immediately, based on a parent that is not yet ready.

It may be possible to hand down what the actual dimensions of the parent will be (as calculated in the resize method) to layoutChildren, and calculate children's positions from that, instead of the parent's DOM node. This may be quite a radical change, but in that way, CSS transitions won't affect the LayoutWidget? resize/layout events.

comment:5 Changed 8 years ago by bill

Status: newpending

comment:6 Changed 8 years ago by Wouter Hager

Status: pendingnew

Nevermind that last comment. It seems resize is actually called twice, the second time with the correct calculation before the transition. I must have some point in my code where this second call gets lost.

comment:7 Changed 8 years ago by bill

Status: newpending

OK. If this is still an issue, then I'm still waiting for a test case. I realize this is an ER rather than a bug report but I still want to see an actual example of the thing you want to support.

comment:8 Changed 8 years ago by Wouter Hager

Status: pendingnew

My bad, usually layout widgets do this correctly. I have some code where resize doesn't set the right dimensions. Apologies.

comment:9 Changed 8 years ago by bill

Resolution: wontfix
Status: newclosed

Ok, no worries, I'll close this then.

Note: See TracTickets for help on using tickets.