Using cookie with jQuery UI Tabs

I need to specify the cookie option after initialization of jQuery UI tabs. Though the cookie appears to be set, the tabs script is ignoring it completely.

If I set the cookie option at initialization, then everything works as expected.

If this a bug? Or am i missing something.

I’ve set up a page to demonstrate the issue:
jQuery UI Tab issue

To summarize, the following does not appear to work.

$( “.selector” ).tabs( “option”, “cookie”, { expires: 30 } );

When you specify cookies later on, the cookie value is saved.
When the page is reloaded without specifying that cookies are to be used, the tabs don’t know that they should set the tab to the cookie-based value.

So, if you are later on telling the tabs that you are using cookies, you may-well also have to set the current tab to that which is specified by the cookie value.