Widget with sub-widgets

Widget with sub-widgets

Hello,

I'm working on the ticket #3905 (http://dev.jqueryui.com/ticket/3905) .
To simplify the problem, when an accordion with autoHeight is in a tab, and the tab is hidden, the resize function of the accordion is called and makes the accordion height equal to 0. And then the accordion is never displayed even if the tab becomes visible.

I made a first partial fix, making the accordion visible but the autoHeight option is not applied.
    I test if the accordion is hidden, in this case the function to calculate the height is not done.
  1.     if ( !this.element.is(":hidden") ) {
   
I'm trying now to make the autoHeight option working in this case. I tried to implement the call to resize when the accordion becomes visible. I added a bind on the event "tabsshow", to call the resize process.
  1.     // resize later when the element won't be hidden
  2.     var resizeHandler = function() {
  3.         self.element.parents(".ui-widget-content").unbind('tabsshow',resizeHandler);
  4.         self.resize();
  5.     };
  6.     this.element.parents(".ui-widget-content").bind('tabsshow', resizeHandler);

It works with the current html sample provided with the ticket. But it isn't working with a more complex html structure.
I made a test in tabs4, with an accordion in an another accordion. The fix doesn't work, because in this case, the "tabshow" event is not sent by the accordion.

1- Do I need to bind any possible events : tabshow, ...
2- Do I need to search for the event to bind :
    - my widget parent is a tab, so I bind tabshow.
    - my widget parent is an accordion, so I bind accordionshow (I didn't find it)
    - ...
3- Is there a more general event, like widgetshow that will solve my problem in any complex html structure ?

The files are available here :
http://github.com/dominiquevincent/jquery-ui/commit/f4d802be6531f81113108c7e4dba98fe2c83eab7

Regards,
Dominique VINCENT