tabs widget, deletion, revert to last chosen tab

tabs widget, deletion, revert to last chosen tab

Hi,

I am keeping a history of tab selection. It is an array that pushes
the selected tab id into an tabHistory array. I have a remove button
on each tab, which when clicked removes the tab and  each
corresponding id entry in the tabHistory array. It also tries to
select the last entry in the array, which might not be the previous
(or following) sibling of the removed tab.

This does not work because of:

               // If selected tab was removed focus tab to the right or
               // in case the last tab was removed the tab to the left.
               if ($li.hasClass('ui-tabs-selected') && this.anchors.length > 1) {
                       this.select(index + (index + 1 < this.anchors.length ? 1 : -1));
               }


The remove event is triggered after that selection, so I tried to make
the selection in a tabs.remove handler (which I really don't want
because of tab flashes and other custom events/server requests).
However, the select call pasted above triggers the select event where
my code adds that tab id to the end of the tabHistory array so it will
always see that id as the tab to choose.

Make sense?

I was hoping there could be a way to shut off the code pasted above or
allow an override.

What do you think?